bert-1.1: BERT implementation

PortabilityGHC
Stabilityexperimental
Maintainermarius@monkey.org

Network.BERT.Server

Contents

Description

BERT-RPC server (http://bert-rpc.org/). This implements the client RPC call/reply logic. Only synchronous requests are supported at this time.

Synopsis

Documentation

Serve

To serve requests, create a transport and call serve with a dispatch function.

 main = do
   t <- fromHostPort "" 8080
   serve t dispatch

 dispatch "calc" "add" [IntTerm a, IntTerm b] = 
   return $ Right $ IntTerm (a + b)
 dispatch _ _ _ = do
   return $ Left "no such m/f!"

serve :: Transport -> (String -> String -> [Term] -> IO DispatchResult) -> IO ()Source

Serve from the given transport (forever), handling each request with the given dispatch function in a new thread.