reroute
Safe HaskellNone
LanguageHaskell2010

Web.Routing.SafeRouting

Synopsis

Documentation

data SlashPolicy Source #

How empty path segments are treated. The compatibility default ignores every empty segment. Strict policies preserve internal and trailing slashes. Redirects are performed by the HTTP adapter, using strict registry matching.

Instances

Instances details
Eq SlashPolicy Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

(==) :: SlashPolicy -> SlashPolicy -> Bool

(/=) :: SlashPolicy -> SlashPolicy -> Bool

Read SlashPolicy Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

readsPrec :: Int -> ReadS SlashPolicy

readList :: ReadS [SlashPolicy]

readPrec :: ReadPrec SlashPolicy

readListPrec :: ReadPrec [SlashPolicy]

Show SlashPolicy Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

showsPrec :: Int -> SlashPolicy -> ShowS

show :: SlashPolicy -> String

showList :: [SlashPolicy] -> ShowS

data RouteHandle (m :: Type -> Type) a Source #

Constructors

RouteHandle (PathInternal as) (HVectElim as (m a)) 

newtype HVectElim' x (ts :: [Type]) Source #

Constructors

HVectElim' 

Fields

type Registry (m :: Type -> Type) a = (PathMap (m a), [[Text] -> m a]) Source #

defRoute :: forall (xs :: [Type]) m a. PathInternal xs -> HVectElim' (m a) xs -> Registry m a -> Registry m a Source #

fallbackRoute :: ([Text] -> m a) -> Registry m a -> Registry m a Source #

matchRoute :: Registry m a -> [Text] -> [m a] Source #

data PathInternal (as :: [Type]) where Source #

Constructors

PI_Empty :: PathInternal ('[] :: [Type]) 
PI_StaticCons :: forall (as :: [Type]). Text -> PathInternal as -> PathInternal as 
PI_VarCons :: forall a (as1 :: [Type]). (FromHttpApiData a, Typeable a) => PathInternal as1 -> PathInternal (a ': as1) 
PI_Wildcard :: forall (as1 :: [Type]). PathInternal as1 -> PathInternal (Text ': as1) 
PI_Extension :: forall (as1 :: [Type]) (bs :: [Type]). PathInternal as1 -> PathInternal bs -> PathInternal (Append as1 bs) 
PI_Append :: forall (as1 :: [Type]) (bs :: [Type]). PathInternal as1 -> PathInternal bs -> PathInternal (Append as1 bs) 

Instances

Instances details
Monad m => MonadReader (PathInternal ('[] :: [Type])) (RegistryT n b middleware reqTypes m) Source  
Instance details

Defined in Web.Routing.Router

Methods

ask :: RegistryT n b middleware reqTypes m (PathInternal ('[] :: [Type]))

local :: (PathInternal ('[] :: [Type]) -> PathInternal ('[] :: [Type])) -> RegistryT n b middleware reqTypes m a -> RegistryT n b middleware reqTypes m a

reader :: (PathInternal ('[] :: [Type]) -> a) -> RegistryT n b middleware reqTypes m a

data PathMap x Source #

Constructors

PathMap 

Instances

Instances details
Functor PathMap Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

fmap :: (a -> b) -> PathMap a -> PathMap b

(<$) :: a -> PathMap b -> PathMap a

NFData x => NFData (PathMap x) Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

rnf :: PathMap x -> ()

Monoid (PathMap x) Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

mempty :: PathMap x

mappend :: PathMap x -> PathMap x -> PathMap x

mconcat :: [PathMap x] -> PathMap x

Semigroup (PathMap x) Source # 
Instance details

Defined in Web.Routing.SafeRouting

Methods

(<>) :: PathMap x -> PathMap x -> PathMap x

sconcat :: NonEmpty (PathMap x) -> PathMap x

stimes :: Integral b => b -> PathMap x -> PathMap x

orderPatterns :: [(Int, a)] -> [(Int, a)] Source #

updatePathMap :: forall ctx (ts :: [Type]) x. (forall y. (ctx -> y) -> PathMap y -> PathMap y) -> PathInternal ts -> (HVect ts -> ctx -> x) -> PathMap x -> PathMap x Source #

insertPathMap' :: forall (ts :: [Type]) x. PathInternal ts -> (HVect ts -> x) -> PathMap x -> PathMap x Source #

singleton :: forall (ts :: [Type]) x. PathInternal ts -> HVectElim ts x -> PathMap x Source #

insertPathMap :: RouteHandle m a -> PathMap (m a) -> PathMap (m a) Source #

insertSubComponent' :: forall (ts :: [Type]) x. PathInternal ts -> (HVect ts -> [Text] -> x) -> PathMap x -> PathMap x Source #

insertSubComponent :: Functor m => RouteHandle m ([Text] -> a) -> PathMap (m a) -> PathMap (m a) Source #

match :: PathMap x -> [Text] -> [x] Source #

(</!>) :: forall (as :: [Type]) (bs :: [Type]). PathInternal as -> PathInternal bs -> PathInternal (Append as bs) Source #

parse :: forall (as :: [Type]). PathInternal as -> [Text] -> Maybe (HVect as) Source #

parsePrefix :: forall (as :: [Type]). PathInternal as -> [Text] -> Maybe (HVect as, [Text]) Source #

extensionSplits :: forall (as :: [Type]). PathInternal as -> Text -> [(Text, Text)] Source #

pathPieceCount :: forall (as :: [Type]). PathInternal as -> Int Source #

pathSpecificity :: forall (as :: [Type]). PathInternal as -> Int Source #