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

Portabilityportable
Stabilityexperimental
MaintainerSebastian Reese (str@holumbus.org)

Holumbus.Console.ServerConsole

Contents

Description

Version : 0.1

This module provides a tiny and nice implementation of a little command shell with communcation over a socket.

It is basically a copy of Holumbus.Console.Console with some changes to fit network communication.

Synopsis

Console datatype

type ConsoleData a = Map String (ConsoleCommand a)Source

Map which contains all commands that the user can execute

Operations

nextOption :: [String] -> IO (Maybe String, [String])Source

gets the next option from the command line as string

parseOption :: Read a => [String] -> IO (Maybe a, [String])Source

Simple parser for the commandline...

initializeConsole :: ConsoleData aSource

Creates a new console datatype

addConsoleCommandSource

Arguments

:: String

command string (the word the user has to enter when he wants to execute the command)

-> ConsoleFunction a

the function which should be executed

-> String

the function description

-> ConsoleData a

the old console data

-> ConsoleData a 

Adds a new console command to the function, an existing command with the same name will be overwritten

startServerConsoleSource

Arguments

:: ConsoleData a

the console data

-> a

the console config

-> Int

console port

-> String

a consoles prompt

-> IO () 

Starts the server listening

defaultaction :: ConsoleData a -> a -> String -> ServerAction StringSource

This defaultimplementaion can be used if a simple INput -> Process command -> output patern is used

defaultconverter :: LineConverter StringSource

default string to a converter. Converts the input lines into desired format. Here String