The remote-monad package

[Tags:bsd3, library, test]

An implementation of the concepts behind Remote Monads. There is support for various bundling strategies.

{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}

module Main where

import Control.Natural (nat, (#))
import Control.Remote.Monad
import Control.Remote.Monad.Packet.Weak

data Command :: * where
  Say :: String -> Command

data Procedure :: * -> * where
  Temperature :: Procedure Int

say :: String -> RemoteMonad Command Procedure ()
say s = command (Say s)

temperature :: RemoteMonad Command Procedure Int
temperature = procedure Temperature

runWP :: WeakPacket Command Procedure a -> IO a
runWP (Command (Say s))       = print s
runWP (Procedure Temperature) = return 42

send :: RemoteMonad Command Procedure a -> IO a
send = run $ runMonad $ nat runWP

main = send $ do
  say "Howdy doodly do"
  say "How about a muffin?"
  t <- temperature
  say (show t ++ "F")

Properties

Versions 0.1.0.0, 0.1.0.1, 0.2 (info)
Dependencies base (>=4.8 && <5), natural-transformation (>=0.3.1 && <0.4), transformers (>=0.4 && <0.6) [details]
License BSD3
Copyright (c) 2016 The University of Kansas
Author Andy Gill, Justin Dawson
Maintainer andygill@ku.edu
Category Control
Source repository head: git clone git://github.com/ku-fpg/remote-monad
Uploaded Mon Feb 8 22:09:25 UTC 2016 by AndyGill
Updated Thu Feb 11 15:04:04 UTC 2016 by AndyGill to revision 1
Distributions NixOS:0.2
Downloads 158 total (3 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-02-12 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees