Maintainer's Corner

Readme for bert

Readme for bert-1.2.1.2

BERT[-RPC] for Haskell

Originally written by marius a. eriksen (marius@monkey.org)

This is a BERT serializer/deserializer and
BERT-RPC client and server for
Haskell. BERT-RPC currently supports
synchronous (call) requests.

The primitives provided are fairly elementary: for the client, call
provides the capability to perform the RPC call, while the server's
serve is provided with a dispatch function providing the dispatching
logic for the server. Thus, one can imagine building higher level
abstractions on top of these primitives.

Installation

It's a cabal package, so

$ cabal install bert

should do the trick.

BERT

import qualified Data.ByteString.Lazy.Char8 as C
import Data.BERT

Creating BERT terms is simple.

TupleTerm [BytelistTerm (C.pack "hello"), IntTerm 123]

Or by using the BERT typeclass.

showBERT $ ("hello", 123)

The BERT class can also read terms back.

Right ("hello", 123) = readBERT . showBERT $ ("hello", 123)

BERT-RPC client

import Data.BERT
import Network.BERT.Client

Create a transport to the server endpoint, and issue a (synchronous)
call with it.