Safe Haskell | None |
---|---|
Language | Haskell98 |
- type UriParts = [String]
- apiError :: MonadError (Reason e) m => Reason e -> m a
- data RouterData m = RouterData {}
- newtype Router m a = Router {}
- runRouter :: Config m -> Method -> UriParts -> Router m (RunnableHandler m) -> Either Reason_ (RunnableHandler m)
- route :: (Applicative m, Monad m) => Maybe Method -> UriParts -> Api m -> Either Reason_ (RunnableHandler m)
- routeWith :: Config m -> Maybe Method -> UriParts -> Api m -> Either Reason_ (RunnableHandler m)
- routeRoot :: Router m s -> Router m (RunnableHandler m)
- routeMultiGet :: Router m s -> MaybeT (Router m) (RunnableHandler m)
- routeRouter :: Router m s -> Router n (RunnableHandler m)
- routeToplevel :: Resource m s sid mid aid -> [Some1 (Router s)] -> Maybe (Cardinality sid mid) -> MaybeT (Router n) (RunnableHandler m)
- routeCreate :: Resource m s sid mid aid -> MaybeT (Router n) (RunnableHandler m)
- routeStep :: Resource m s sid mid aid -> [Some1 (Router s)] -> Step sid mid aid -> Router n (RunnableHandler m)
- routeNamed :: Resource m s sid mid aid -> [Some1 (Router s)] -> Endpoint sid mid aid -> Router n (RunnableHandler m)
- routeUnnamed :: Resource m s sid mid aid -> [Some1 (Router s)] -> Cardinality (Id sid) (Id mid) -> Router n (RunnableHandler m)
- routeGetter :: Getter sid -> Resource m s sid mid aid -> [Some1 (Router s)] -> Router n (RunnableHandler m)
- multi :: Resource m s sid mid aid -> Id sid -> Router n (RunnableHandler m)
- routeListGetter :: Monad m => Getter mid -> (mid -> ListHandler m) -> Router n (RunnableHandler m)
- withSubresource :: sid -> Resource m s sid mid aid -> [Some1 (Router s)] -> Router n (RunnableHandler m)
- routeSingle :: sid -> Resource m s sid mid aid -> Router n (RunnableHandler m)
- routeName :: String -> Router n ()
- routeListHandler :: Monad m => ListHandler m -> Router n (RunnableHandler m)
- lookupRouter :: String -> [Some1 (Router s)] -> Maybe (Some1 (Router s))
- parseIdent :: MonadError (Reason e) m => Id id -> String -> m id
- splitUriString :: String -> UriParts
- popSegment :: Router n String
- withSegment :: Router n a -> (String -> Router n a) -> Router n a
- noRestPath :: Router n ()
- guardNullPath :: (MonadPlus m, MonadState UriParts m) => m ()
- hasMethod :: Method -> Router n ()
- guardMethod :: (MonadPlus m, MonadReader (RouterData c) m) => Method -> m ()
- mkListHandler :: Monad m => ListHandler m -> Maybe (Handler m)
- mkListAction :: Monad m => (Env h p i -> ExceptT (Reason e) m [a]) -> Env h (Range, p) i -> ExceptT (Reason e) m (List a)
- mkMultiHandler :: Monad m => Id id -> (id -> Run s m) -> Handler s -> Maybe (Handler m)
- mkMultiGetHandler :: forall m s. (Applicative m, Monad m) => Config m -> Router m s -> Handler m
- defaultRunMultiResources :: (Applicative m, Monad m) => Config m -> Router m s -> [Resource] -> ExceptT Reason_ m [BodyPart]
- defaultConfig :: (Applicative m, Monad m) => Config m
- runResource :: (Applicative m, Monad m) => Config m -> Router m s -> Resource -> m BodyPart
- routeResource :: Config m -> Router m s -> Resource -> Either Reason_ (RunnableHandler m)
- toRestInput :: Resource -> RestInput
- mkHeaders :: HashMap String d -> [(HeaderName, d)]
- mkBodyPart :: ByteString -> RestOutput -> BodyPart
- fromMaybeT :: Monad m => m a -> MaybeT m a -> m a
Documentation
runRouter :: Config m -> Method -> UriParts -> Router m (RunnableHandler m) -> Either Reason_ (RunnableHandler m) Source #
route :: (Applicative m, Monad m) => Maybe Method -> UriParts -> Api m -> Either Reason_ (RunnableHandler m) Source #
routeWith :: Config m -> Maybe Method -> UriParts -> Api m -> Either Reason_ (RunnableHandler m) Source #
routeMultiGet :: Router m s -> MaybeT (Router m) (RunnableHandler m) Source #
routeRouter :: Router m s -> Router n (RunnableHandler m) Source #
routeToplevel :: Resource m s sid mid aid -> [Some1 (Router s)] -> Maybe (Cardinality sid mid) -> MaybeT (Router n) (RunnableHandler m) Source #
routeCreate :: Resource m s sid mid aid -> MaybeT (Router n) (RunnableHandler m) Source #
routeStep :: Resource m s sid mid aid -> [Some1 (Router s)] -> Step sid mid aid -> Router n (RunnableHandler m) Source #
routeNamed :: Resource m s sid mid aid -> [Some1 (Router s)] -> Endpoint sid mid aid -> Router n (RunnableHandler m) Source #
routeUnnamed :: Resource m s sid mid aid -> [Some1 (Router s)] -> Cardinality (Id sid) (Id mid) -> Router n (RunnableHandler m) Source #
routeGetter :: Getter sid -> Resource m s sid mid aid -> [Some1 (Router s)] -> Router n (RunnableHandler m) Source #
routeListGetter :: Monad m => Getter mid -> (mid -> ListHandler m) -> Router n (RunnableHandler m) Source #
withSubresource :: sid -> Resource m s sid mid aid -> [Some1 (Router s)] -> Router n (RunnableHandler m) Source #
routeSingle :: sid -> Resource m s sid mid aid -> Router n (RunnableHandler m) Source #
routeListHandler :: Monad m => ListHandler m -> Router n (RunnableHandler m) Source #
parseIdent :: MonadError (Reason e) m => Id id -> String -> m id Source #
splitUriString :: String -> UriParts Source #
popSegment :: Router n String Source #
noRestPath :: Router n () Source #
guardNullPath :: (MonadPlus m, MonadState UriParts m) => m () Source #
guardMethod :: (MonadPlus m, MonadReader (RouterData c) m) => Method -> m () Source #
mkListHandler :: Monad m => ListHandler m -> Maybe (Handler m) Source #
mkListAction :: Monad m => (Env h p i -> ExceptT (Reason e) m [a]) -> Env h (Range, p) i -> ExceptT (Reason e) m (List a) Source #
mkMultiGetHandler :: forall m s. (Applicative m, Monad m) => Config m -> Router m s -> Handler m Source #
defaultRunMultiResources :: (Applicative m, Monad m) => Config m -> Router m s -> [Resource] -> ExceptT Reason_ m [BodyPart] Source #
defaultConfig :: (Applicative m, Monad m) => Config m Source #
runResource :: (Applicative m, Monad m) => Config m -> Router m s -> Resource -> m BodyPart Source #
routeResource :: Config m -> Router m s -> Resource -> Either Reason_ (RunnableHandler m) Source #
toRestInput :: Resource -> RestInput Source #
mkBodyPart :: ByteString -> RestOutput -> BodyPart Source #
Utilities
fromMaybeT :: Monad m => m a -> MaybeT m a -> m a Source #