-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | abstract implementation of typed and untyped web routing
--
-- abstraction over how urls with/without parameters are mapped to their
-- corresponding handlers
@package reroute
@version 0.7.0.0
module Data.PolyMap
data PolyMap (c :: * -> Constraint) (f :: * -> *) (a :: *)
empty :: PolyMap c f a
rnfHelper :: (forall p. c p => f (p -> a) -> ()) -> PolyMap c f a -> ()
lookup :: Typeable p => PolyMap c f a -> Maybe (f (p -> a))
lookupApply :: (Typeable p, Functor f) => p -> PolyMap c f a -> Maybe (f a)
lookupApplyAll :: Functor f => (forall p. c p => Maybe p) -> PolyMap c f a -> [f a]
lookupConcat :: (Monoid m, Functor f) => (forall p. c p => Maybe p) -> (forall p. c p => p -> f (p -> a) -> m) -> PolyMap c f a -> m
alter :: (Typeable p, c p) => (Maybe (f (p -> a)) -> Maybe (f (p -> a))) -> PolyMap c f a -> PolyMap c f a
updateAll :: (forall p. c p => f (p -> a) -> g (p -> b)) -> PolyMap c f a -> PolyMap c g b
insertWith :: (Typeable p, c p) => (f (p -> a) -> f (p -> a) -> f (p -> a)) -> f (p -> a) -> PolyMap c f a -> PolyMap c f a
unionWith :: (forall p. c p => f (p -> a) -> f (p -> a) -> f (p -> a)) -> PolyMap c f a -> PolyMap c f a -> PolyMap c f a
union :: Alternative f => PolyMap c f a -> PolyMap c f a -> PolyMap c f a
zipWith' :: (forall p. c p => Maybe (f (p -> a)) -> Maybe (f (p -> b)) -> Maybe (f (p -> d))) -> PolyMap c f a -> PolyMap c f b -> PolyMap c f d
zipWith :: Applicative f => (a -> b -> d) -> PolyMap c f a -> PolyMap c f b -> PolyMap c f d
zip :: Applicative f => PolyMap c f a -> PolyMap c f b -> PolyMap c f (a, b)
ap :: Applicative f => PolyMap c f (a -> b) -> PolyMap c f a -> PolyMap c f b
instance GHC.Base.Functor f => GHC.Base.Functor (Data.PolyMap.PolyMap c f)
instance GHC.Base.Alternative f => GHC.Base.Semigroup (Data.PolyMap.PolyMap c f a)
instance GHC.Base.Alternative f => GHC.Base.Monoid (Data.PolyMap.PolyMap c f a)
module Web.Routing.SafeRouting
data RouteHandle m a
RouteHandle :: PathInternal as -> HVectElim as (m a) -> RouteHandle m a
newtype HVectElim' x ts
HVectElim' :: HVectElim ts x -> HVectElim' x ts
[flipHVectElim] :: HVectElim' x ts -> HVectElim ts x
type Registry m a = (PathMap (m a), [[Text] -> m a])
emptyRegistry :: Registry m a
defRoute :: PathInternal xs -> HVectElim' (m a) xs -> Registry m a -> Registry m a
fallbackRoute :: ([Text] -> m a) -> Registry m a -> Registry m a
matchRoute :: Registry m a -> [Text] -> [m a]
data PathInternal (as :: [*])
[PI_Empty] :: PathInternal '[]
[PI_StaticCons] :: Text -> PathInternal as -> PathInternal as
[PI_VarCons] :: (FromHttpApiData a, Typeable a) => PathInternal as -> PathInternal (a : as)
[PI_Wildcard] :: PathInternal as -> PathInternal (Text : as)
data PathMap x
PathMap :: [[Text] -> x] -> [x] -> HashMap Text (PathMap x) -> PolyMap FromHttpApiData PathMap x -> [Text -> x] -> PathMap x
[pm_subComponents] :: PathMap x -> [[Text] -> x]
[pm_here] :: PathMap x -> [x]
[pm_staticMap] :: PathMap x -> HashMap Text (PathMap x)
[pm_polyMap] :: PathMap x -> PolyMap FromHttpApiData PathMap x
[pm_wildcards] :: PathMap x -> [Text -> x]
emptyPathMap :: PathMap x
updatePathMap :: (forall y. (ctx -> y) -> PathMap y -> PathMap y) -> PathInternal ts -> (HVect ts -> ctx -> x) -> PathMap x -> PathMap x
insertPathMap' :: PathInternal ts -> (HVect ts -> x) -> PathMap x -> PathMap x
singleton :: PathInternal ts -> HVectElim ts x -> PathMap x
insertPathMap :: RouteHandle m a -> PathMap (m a) -> PathMap (m a)
insertSubComponent' :: PathInternal ts -> (HVect ts -> [Text] -> x) -> PathMap x -> PathMap x
insertSubComponent :: Functor m => RouteHandle m ([Text] -> a) -> PathMap (m a) -> PathMap (m a)
match :: PathMap x -> [Text] -> [x]
(!>) :: PathInternal as -> PathInternal bs -> PathInternal (Append as bs)
combineRoutePieces :: [Text] -> Text
parse :: PathInternal as -> [Text] -> Maybe (HVect as)
instance GHC.Base.Functor Web.Routing.SafeRouting.PathMap
instance Control.DeepSeq.NFData x => Control.DeepSeq.NFData (Web.Routing.SafeRouting.PathMap x)
instance GHC.Base.Semigroup (Web.Routing.SafeRouting.PathMap x)
instance GHC.Base.Monoid (Web.Routing.SafeRouting.PathMap x)
module Web.Routing.Router
newtype RegistryT n b middleware reqTypes (m :: * -> *) a
RegistryT :: RWST (PathInternal '[]) [middleware] (RegistryState n b reqTypes) m a -> RegistryT n b middleware reqTypes (m :: * -> *) a
[runRegistryT] :: RegistryT n b middleware reqTypes (m :: * -> *) a -> RWST (PathInternal '[]) [middleware] (RegistryState n b reqTypes) m a
data RegistryState n b reqTypes
RegistryState :: !HashMap reqTypes (Registry n b) -> !Registry n b -> RegistryState n b reqTypes
[rs_registry] :: RegistryState n b reqTypes -> !HashMap reqTypes (Registry n b)
[rs_anyMethod] :: RegistryState n b reqTypes -> !Registry n b
hookAny :: (Monad m, Eq reqTypes, Hashable reqTypes) => reqTypes -> ([Text] -> n b) -> RegistryT n b middleware reqTypes m ()
hookAnyMethod :: Monad m => ([Text] -> n b) -> RegistryT n b middleware reqTypes m ()
hookRoute :: (Monad m, Eq reqTypes, Hashable reqTypes) => reqTypes -> PathInternal as -> HVectElim' (n b) as -> RegistryT n b middleware reqTypes m ()
hookRouteAnyMethod :: Monad m => PathInternal as -> HVectElim' (n b) as -> RegistryT n b middleware reqTypes m ()
middleware :: Monad m => middleware -> RegistryT n b middleware reqTypes m ()
swapMonad :: Monad m => (forall b. n b -> m b) -> RegistryT x y middleware reqTypes n a -> RegistryT x y middleware reqTypes m a
runRegistry :: (Monad m, Hashable reqTypes, Eq reqTypes) => RegistryT n b middleware reqTypes m a -> m (a, reqTypes -> [Text] -> [n b], [middleware])
instance Control.Monad.Trans.Class.MonadTrans (Web.Routing.Router.RegistryT n b middleware reqTypes)
instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState (Web.Routing.Router.RegistryState n b reqTypes) (Web.Routing.Router.RegistryT n b middleware reqTypes m)
instance GHC.Base.Monad m => Control.Monad.Writer.Class.MonadWriter [middleware] (Web.Routing.Router.RegistryT n b middleware reqTypes m)
instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader (Web.Routing.SafeRouting.PathInternal '[]) (Web.Routing.Router.RegistryT n b middleware reqTypes m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Web.Routing.Router.RegistryT n b middleware reqTypes m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Web.Routing.Router.RegistryT n b middleware reqTypes m)
instance GHC.Base.Functor m => GHC.Base.Functor (Web.Routing.Router.RegistryT n b middleware reqTypes m)
instance GHC.Base.Monad m => GHC.Base.Monad (Web.Routing.Router.RegistryT n b middleware reqTypes m)
module Web.Routing.Combinators
data PathState
Open :: PathState
Closed :: PathState
data Path (as :: [*]) (pathState :: PathState)
[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
toInternalPath :: Path as pathState -> PathInternal as
type Var a = Path (a : '[]) 'Open
-- | 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.
data AltVar a b
AvLeft :: a -> AltVar a b
AvRight :: b -> AltVar a b
-- | A route parameter
var :: (Typeable a, FromHttpApiData a) => Path (a : '[]) 'Open
-- | A static route piece
static :: String -> Path '[] 'Open
-- | The root of a path piece. Use to define a handler for "/"
root :: Path '[] 'Open
-- | Matches the rest of the route. Should be the last part of the path.
wildcard :: Path '[Text] 'Closed
(>) :: Path as 'Open -> Path bs ps2 -> Path (Append as bs) ps2
pathToRep :: Path as ps -> Rep as
renderRoute :: AllHave ToHttpApiData as => Path as 'Open -> HVect as -> Text
renderRoute' :: AllHave ToHttpApiData as => Path as 'Open -> HVect as -> [Text]
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Web.Routing.Combinators.AltVar a b)
instance (GHC.Read.Read a, GHC.Read.Read b) => GHC.Read.Read (Web.Routing.Combinators.AltVar a b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Web.Routing.Combinators.AltVar a b)
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Web.Routing.Combinators.AltVar a b)
instance (Web.Internal.HttpApiData.FromHttpApiData a, Web.Internal.HttpApiData.FromHttpApiData b) => Web.Internal.HttpApiData.FromHttpApiData (Web.Routing.Combinators.AltVar a b)
instance (a GHC.Types.~ '[], pathState GHC.Types.~ 'Web.Routing.Combinators.Open) => Data.String.IsString (Web.Routing.Combinators.Path a pathState)