The remote-json package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.


JSON RPC, where you can using monads and applicative functors to bundle JSON RPC methods and notifications.

{-# LANGUAGE GADTs, OverloadedStrings, TypeOperators #-}

module Main where

import Control.Natural ((:~>), nat)
import Control.Remote.Monad.JSON
import Control.Remote.Monad.JSON.Router(transport,router,Call(..),methodNotFound)
import Data.Aeson
import Data.Text(Text)

-- Our small DSL

say :: Text -> RPC ()
say msg = notification "say" (List [String msg])

temperature :: RPC Int
temperature = method "temperature" None

-- Our remote program

main :: IO ()
main = do
  let s = weakSession network
  t <- send s $ do
    say "Hello, "
    say "World!"
  print t

-- Simulate the JSON-RPC server

network :: SendAPI :~> IO
network = transport $ router sequence $ nat remote
    remote :: Call a -> IO a
    remote (CallMethod "temperature" _)                 = return $ Number 42
    remote (CallNotification "say" (List [String msg])) = print msg
    remote _                                            = methodNotFound

[Skip to ReadMe]


Versions0.2, 0.2
Change logNone available
Dependenciesaeson (>=0.8 && <0.12), base (==4.*), exceptions (==0.8.*), fail, natural-transformation (>=0.3.1 && <0.4), remote-monad (==0.2), text (==1.2.*), transformers (>=0.4 && <0.6), unordered-containers (>=0.2.5 && <0.2.7), vector (==0.11.*) [details]
Copyright(c) 2016 The University of Kansas
AuthorJustin Dawson and Andy Gill
Source repositoryhead: git clone git://
UploadedTue Feb 9 20:02:28 UTC 2016 by AndyGill




Maintainers' corner

For package maintainers and hackage trustees

Readme for remote-json-0.2

remote-json Build Status

JSON RPC using the remote monad