jsonrpc-conduit-0.3.0: JSON-RPC 2.0 server over a Conduit.

Copyright(c) 2012-2013 Gabriele Sales <gbrsales@gmail.com>
Safe HaskellNone



JSON-RPC methods.



data Method m where Source

A wrapper over a monadic function that can either succeed or fail with a MethodError.

Hides the input and output types.


Method :: forall i m o. (FromJSON i, ToJSON o) => (i -> m (Either MethodError o)) -> Method m 

data MethodError Source

Represents an error with an integer code and a textual message.


MethodError !Int !Text 

data NamedMethod m Source

A Method with a name.

method :: (FromJSON i, ToJSON o) => Text -> (i -> m (Either MethodError o)) -> NamedMethod m Source

Builds a NamedMethod given its name and function.

Useful in conjuction with fromList.

data Methods m Source

Collection of NamedMethods.

fromList :: [NamedMethod m] -> Methods m Source

Builds a collection from a list of NamedMethods.

lookup :: Methods m -> Text -> Maybe (Method m) Source

Looks up the method corresponding to the given name.