jsonrpc-conduit-0.3.13: JSON-RPC 2.0 server over a Conduit.
Copyright(c) 2012-2013 Gabriele Sales <gbrsales@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Conduit.JsonRpc.Methods

Description

JSON-RPC methods.

Synopsis

Documentation

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.

Constructors

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.

Constructors

MethodError !Int !Text 

Instances

Instances details
Show MethodError Source # 
Instance details

Defined in Data.Conduit.JsonRpc.Methods

Eq MethodError Source # 
Instance details

Defined in Data.Conduit.JsonRpc.Methods

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.