mig-0.2.1.0: Build lightweight and composable servers
Safe HaskellSafe-Inferred
LanguageGHC2021

Mig.Core.Class.Monad

Description

Type-level function to extract underlying server monad

Synopsis

Documentation

type family MonadOf a :: Type -> Type where ... Source #

Equations

MonadOf (Send method m a) = m 
MonadOf (Request -> m (Maybe Response)) = m 
MonadOf (f m) = m 
MonadOf (a -> b) = MonadOf b 
MonadOf [a] = MonadOf a 

newtype Send method m a Source #

Route response type. It encodes the route method in the type and which monad is used and which type the response has.

The repsonse value is usually one of two cases:

  • Resp media a -- for routes which always produce a value
  • RespOr media err a - for routes that can also produce an error or value.

See the class IsResp for more details on response types.

Constructors

Send 

Fields

Instances

Instances details
MonadTrans (Send method :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Mig.Core.Types.Route

Methods

lift :: Monad m => m a -> Send method m a #

MonadIO m => MonadIO (Send method m) Source # 
Instance details

Defined in Mig.Core.Types.Route

Methods

liftIO :: IO a -> Send method m a #

Applicative m => Applicative (Send method m) Source # 
Instance details

Defined in Mig.Core.Types.Route

Methods

pure :: a -> Send method m a #

(<*>) :: Send method m (a -> b) -> Send method m a -> Send method m b #

liftA2 :: (a -> b -> c) -> Send method m a -> Send method m b -> Send method m c #

(*>) :: Send method m a -> Send method m b -> Send method m b #

(<*) :: Send method m a -> Send method m b -> Send method m a #

Functor m => Functor (Send method m) Source # 
Instance details

Defined in Mig.Core.Types.Route

Methods

fmap :: (a -> b) -> Send method m a -> Send method m b #

(<$) :: a -> Send method m b -> Send method m a #

Monad m => Monad (Send method m) Source # 
Instance details

Defined in Mig.Core.Types.Route

Methods

(>>=) :: Send method m a -> (a -> Send method m b) -> Send method m b #

(>>) :: Send method m a -> Send method m b -> Send method m b #

return :: a -> Send method m a #

(MonadIO m, IsResp a, IsMethod method) => ToRoute (Send method m a) Source # 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo Source #

toRouteFun :: Send method m a -> ServerFun (MonadOf (Send method m a)) Source #