Holumbus-Distribution-0.1.1: intra- and inter-program communication

Portabilityportable
Stabilityexperimental
MaintainerSebastian Reese (str@holumbus.org)

Holumbus.Network.DoWithServer

Description

Version : 0.1

This module provides an interface to start a server listeing on a tcp socket. ( Module is based on simple tcp server found here http:sequence.complete.orgnode258 )

You have to implement 2 functions type ServerAction a = a -> Client a -> [Client a] -> IO [Client a]

and

type LineConverter a = String -> a

to start a server use the doWithServer :: (Show a) => Int -> ServerAction a -> LineConverter a -> String -> IO () function.

Synopsis

Documentation

data Client a Source

the connecting client type

Instances

Eq (Client a) 
Ord (Client a) 
Show (Client a) 

type ServerAction a = a -> Client a -> [Client a] -> IO [Client a]Source

type for call back function that is executed within server cycle

type LineConverter a = String -> aSource

converts the string read by hGetLine to your datatype

doWithServer :: Show a => Int -> ServerAction a -> LineConverter a -> String -> IO ()Source

execute a ServerAction wrapped by the tcp server