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

Safe HaskellNone



JSON-RPC methods.



data Method m whereSource

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 mSource

Builds a NamedMethod given its name and function.

Useful in conjuction with fromList.

data Methods m Source

Collection of NamedMethods.

fromList :: [NamedMethod m] -> Methods mSource

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.