Safe Haskell | None |
---|---|
Language | Haskell2010 |
Web.Routing.Combinators
Synopsis
- data PathState
- data Path (as :: [Type]) (pathState :: PathState) where
- Empty :: Path ('[] :: [Type]) 'Open
- StaticCons :: forall (as :: [Type]) (pathState :: PathState). Text -> Path as pathState -> Path as pathState
- VarCons :: forall a (as1 :: [Type]) (pathState :: PathState). (FromHttpApiData a, Typeable a) => Path as1 pathState -> Path (a ': as1) pathState
- Wildcard :: forall (as1 :: [Type]). Path as1 'Open -> Path (Text ': as1) 'Closed
- toInternalPath :: forall (as :: [Type]) (pathState :: PathState). Path as pathState -> PathInternal as
- type Var a = Path '[a] 'Open
- data AltVar a b
- var :: (Typeable a, FromHttpApiData a) => Path '[a] 'Open
- static :: String -> Path ('[] :: [Type]) 'Open
- root :: Path ('[] :: [Type]) 'Open
- wildcard :: Path '[Text] 'Closed
- (</>) :: forall (as :: [Type]) (bs :: [Type]) (ps2 :: PathState). Path as 'Open -> Path bs ps2 -> Path (Append as bs) ps2
- pathToRep :: forall (as :: [Type]) (ps :: PathState). Path as ps -> Rep as
- renderRoute :: forall (as :: [Type]). AllHave ToHttpApiData as => Path as 'Open -> HVect as -> Text
- renderRoute' :: forall (as :: [Type]). AllHave ToHttpApiData as => Path as 'Open -> HVect as -> [Text]
Documentation
data Path (as :: [Type]) (pathState :: PathState) where Source #
Constructors
Empty :: Path ('[] :: [Type]) 'Open | |
StaticCons :: forall (as :: [Type]) (pathState :: PathState). Text -> Path as pathState -> Path as pathState | |
VarCons :: forall a (as1 :: [Type]) (pathState :: PathState). (FromHttpApiData a, Typeable a) => Path as1 pathState -> Path (a ': as1) pathState | |
Wildcard :: forall (as1 :: [Type]). Path as1 'Open -> Path (Text ': as1) 'Closed |
toInternalPath :: forall (as :: [Type]) (pathState :: PathState). Path as pathState -> PathInternal as Source #
A variant of Either
with a FromHttpApiData
definition that tries both branches without a prefix.
Useful to define routes with var
s that should work with different types.
Instances
(Read a, Read b) => Read (AltVar a b) Source # | |
(Show a, Show b) => Show (AltVar a b) Source # | |
(Eq a, Eq b) => Eq (AltVar a b) Source # | |
(Ord a, Ord b) => Ord (AltVar a b) Source # | |
Defined in Web.Routing.Combinators | |
(FromHttpApiData a, FromHttpApiData b) => FromHttpApiData (AltVar a b) Source # | |
Defined in Web.Routing.Combinators Methods parseUrlPiece :: Text -> Either Text (AltVar a b) # parseHeader :: ByteString -> Either Text (AltVar a b) # |
root :: Path ('[] :: [Type]) 'Open Source #
The root of a path piece. Use to define a handler for "/"
wildcard :: Path '[Text] 'Closed Source #
Matches the rest of the route. Should be the last part of the path.
(</>) :: forall (as :: [Type]) (bs :: [Type]) (ps2 :: PathState). Path as 'Open -> Path bs ps2 -> Path (Append as bs) ps2 Source #
renderRoute :: forall (as :: [Type]). AllHave ToHttpApiData as => Path as 'Open -> HVect as -> Text Source #
renderRoute' :: forall (as :: [Type]). AllHave ToHttpApiData as => Path as 'Open -> HVect as -> [Text] Source #