remote-json-0.2: Remote Monad implementation of the JSON RPC protocol

Copyright(C) 2015, The University of Kansas
LicenseBSD-style (see the file LICENSE)
MaintainerJustin Dawson
StabilityAlpha
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Control.Remote.Monad.JSON

Contents

Description

 

Synopsis

JSON-RPC DSL

data RPC a Source

The JSON RPC remote monad

method :: FromJSON a => Text -> Args -> RPC a Source

Sets up a JSON-RPC method call with the function name and arguments

notification :: Text -> Args -> RPC () Source

Sets up a JSON-RPC notification call with the function name and arguments

Invoke the JSON RPC Remote Monad

send :: Session -> RPC a -> IO a Source

Send RPC Notifications and Methods by using the given session

data Session Source

Session is a handle used for where to send a sequence of monadic commands.

weakSession :: (SendAPI :~> IO) -> Session Source

Takes a function that handles the sending of Async and Sync messages, and sends each Notification and Method one at a time

strongSession :: (SendAPI :~> IO) -> Session Source

Takes a function that handles the sending of Async and Sync messages, and bundles Notifications together terminated by an optional Method

applicativeSession :: (SendAPI :~> IO) -> Session Source

Takes a function that handles the sending of Async and Sync messages, and bundles together Notifications and Procedures that are used in Applicative calls

data SendAPI :: * -> * where Source

The client-side send function API. The user provides a way of dispatching this, to implement a client. An example of this using wreq is found in remote-json-client

  • For Sync, a JSON Value is send, and a JSON Value is received back as a reply.
  • For Async, a JSON Value is send, and the reply, if any, is ignored.

Constructors

Sync :: Value -> SendAPI Value 
Async :: Value -> SendAPI () 

Instances

Types

data Args where Source

Args follows the JSON-RPC spec: either a list of values, or an (unordered) list of named fields, or none.

Constructors

List :: [Value] -> Args 
Named :: [(Text, Value)] -> Args 
None :: Args