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 :: [*]) (pathState :: PathState) where Source #

Constructors

Empty :: Path '[] 'Open 
StaticCons :: Text -> Path as ps -> Path as ps 
VarCons :: (FromHttpApiData a, Typeable a) => Path as ps -> Path (a ': as) ps 
Wildcard :: Path as 'Open -> Path (Text ': as) '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 :: 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
(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 #

(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 #

(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 '[] 'Open Source #

A static route piece

root :: Path '[] '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.

(</>) :: Path as 'Open -> Path bs ps2 -> Path (Append as bs) ps2 Source #

pathToRep :: Path as ps -> Rep as Source #