Holumbus-Distribution-0.1.0: intra- and inter-program communicationSource codeContentsIndex
Holumbus.Console.ServerConsole
Portabilityportable
Stabilityexperimental
MaintainerSebastian Reese (str@holumbus.org)
Contents
Console datatype
Operations
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
type ConsoleData a = Map String (ConsoleCommand a)
nextOption :: [String] -> IO (Maybe String, [String])
parseOption :: Read a => [String] -> IO (Maybe a, [String])
initializeConsole :: ConsoleData a
addConsoleCommand :: String -> ConsoleFunction a -> String -> ConsoleData a -> ConsoleData a
startServerConsole :: ConsoleData a -> a -> Int -> String -> IO ()
defaultaction :: ConsoleData a -> a -> String -> ServerAction String
defaultconverter :: LineConverter String
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
:: Stringcommand string (the word the user has to enter when he wants to execute the command)
-> ConsoleFunction athe function which should be executed
-> Stringthe function description
-> ConsoleData athe old console data
-> ConsoleData a
Adds a new console command to the function, an existing command with the same name will be overwritten
startServerConsoleSource
:: ConsoleData athe console data
-> athe console config
-> Intconsole port
-> Stringa 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
Produced by Haddock version 2.6.1