Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Classes for converting functions to RPC handlers that may have special parameters.
Synopsis
- class HandlerArg a r where
- handlerArg :: [Object] -> Sem r ([Object], a)
- class HandlerCodec h r | h -> r where
- handlerCodec :: h -> RpcHandlerFun r
Documentation
class HandlerArg a r where Source #
This class is used by HandlerCodec
to decode handler function parameters.
Each parameter may consume zero or arbitrarily many of the RPC message's arguments.
Users may create instances for their types to implement custom decoding, especially for commands, since those don't have structured arguments.
See also CommandHandler
.
Instances
Member (Stop Report) r => HandlerArg ArgList r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
Member (Stop Report) r => HandlerArg Args r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
Member (Stop Report) r => HandlerArg Bang r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
HandlerArg Bar r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
(Member (Stop Report) r, MsgpackDecode a) => HandlerArg a r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
(Member (Stop Report) r, FromJSON a) => HandlerArg (JsonArgs a) r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
(Member (Stop Report) r, OptionParser a) => HandlerArg (Options a) r Source # | |
Defined in Ribosome.Host.Handler.Codec | |
HandlerArg a r => HandlerArg (Maybe a) r Source # | |
Defined in Ribosome.Host.Handler.Codec |
class HandlerCodec h r | h -> r where Source #
The class of functions that can be converted to canonical RPC handlers of type RpcHandlerFun
.
handlerCodec :: h -> RpcHandlerFun r Source #
Convert a type containing a Sem
to a canonicalized RpcHandlerFun
by transforming each function parameter with
HandlerArg
.
Instances
MsgpackEncode a => HandlerCodec (Handler r a) r Source # | |
Defined in Ribosome.Host.Handler.Codec handlerCodec :: Handler r a -> RpcHandlerFun r Source # | |
(HandlerArg a (Stop Report ': r), HandlerCodec b r) => HandlerCodec (a -> b) r Source # | |
Defined in Ribosome.Host.Handler.Codec handlerCodec :: (a -> b) -> RpcHandlerFun r Source # |