Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extends Servant with context. Basically wrapping Servant in a ReaderT of your type. Which should be a tuple of all your moudles and configs and stuff, so that the Data.Has module would let you access these items by type.
- newtype MagicbaneApp β α = MagicbaneApp {
- unMagicbaneApp :: ReaderT β Handler α
- runMagicbaneHandler :: β -> MagicbaneApp β α -> Handler α
- magicbaneApp :: (HasServer * api ([] *), HasServer * api context) => Proxy * api -> Context context -> t -> ServerT * api (MagicbaneApp t) -> Application
- askObj :: (Has β α, MonadReader α μ) => μ β
- askOpt :: (Has β α, MonadReader α μ) => (β -> ψ) -> μ ψ
Documentation
newtype MagicbaneApp β α Source #
MagicbaneApp | |
|
MonadReader β (MagicbaneApp β) Source # | |
MonadBaseControl IO (MagicbaneApp β) Source # | |
MonadBase IO (MagicbaneApp β) Source # | |
MonadError ServantErr (MagicbaneApp β) Source # | |
Monad (MagicbaneApp β) Source # | |
Functor (MagicbaneApp β) Source # | |
Applicative (MagicbaneApp β) Source # | |
MonadIO (MagicbaneApp β) Source # | |
MonadCatch (MagicbaneApp β) Source # | |
MonadThrow (MagicbaneApp β) Source # | |
type StM (MagicbaneApp β) α Source # | |
runMagicbaneHandler :: β -> MagicbaneApp β α -> Handler α Source #
magicbaneApp :: (HasServer * api ([] *), HasServer * api context) => Proxy * api -> Context context -> t -> ServerT * api (MagicbaneApp t) -> Application Source #
Constructs a WAI application from an API definition, a Servant context (used for auth mainly), the app context and the actual action handlers.
askObj :: (Has β α, MonadReader α μ) => μ β Source #
Gets a value of any type from the context.
askOpt :: (Has β α, MonadReader α μ) => (β -> ψ) -> μ ψ Source #
Gets a thing from a value of any type from the context. (Useful for configuration fields.)