reroute-0.7.0.0: abstract implementation of typed and untyped web routing
Safe HaskellNone
LanguageHaskell2010

Web.Routing.Combinators

Synopsis

Documentation

data PathState Source #

Constructors

Open 
Closed 

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 

Instances

Instances details
(a ~ ('[] :: [Type]), pathState ~ 'Open) => IsString (Path a pathState) Source # 
Instance details

Defined in Web.Routing.Combinators

Methods

fromString :: String -> Path a pathState #

toInternalPath :: forall (as :: [Type]) (pathState :: PathState). Path as pathState -> PathInternal as Source #

type Var a = Path '[a] 'Open Source #

data AltVar a b Source #

A variant of Either with a FromHttpApiData definition that tries both branches without a prefix. Useful to define routes with vars that should work with different types.

Constructors

AvLeft a 
AvRight b 

Instances

Instances details
(Read a, Read b) => Read (AltVar a b) Source # 
Instance details

Defined in Web.Routing.Combinators

(Show a, Show b) => Show (AltVar a b) Source # 
Instance details

Defined in Web.Routing.Combinators

Methods

showsPrec :: Int -> AltVar a b -> ShowS #

show :: AltVar a b -> String #

showList :: [AltVar a b] -> ShowS #

(Eq a, Eq b) => Eq (AltVar a b) Source # 
Instance details

Defined in Web.Routing.Combinators

Methods

(==) :: AltVar a b -> AltVar a b -> Bool #

(/=) :: AltVar a b -> AltVar a b -> Bool #

(Ord a, Ord b) => Ord (AltVar a b) Source # 
Instance details

Defined in Web.Routing.Combinators

Methods

compare :: AltVar a b -> AltVar a b -> Ordering #

(<) :: AltVar a b -> AltVar a b -> Bool #

(<=) :: AltVar a b -> AltVar a b -> Bool #

(>) :: AltVar a b -> AltVar a b -> Bool #

(>=) :: AltVar a b -> AltVar a b -> Bool #

max :: AltVar a b -> AltVar a b -> AltVar a b #

min :: AltVar a b -> AltVar a b -> AltVar a b #

(FromHttpApiData a, FromHttpApiData b) => FromHttpApiData (AltVar a b) Source # 
Instance details

Defined in Web.Routing.Combinators

var :: (Typeable a, FromHttpApiData a) => Path '[a] 'Open Source #

A route parameter

static :: String -> Path ('[] :: [Type]) 'Open Source #

A static route piece

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 #

pathToRep :: forall (as :: [Type]) (ps :: PathState). Path as ps -> Rep as 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 #