Pup-Events-Server-1.2: A networked event handling framework for hooking into other programs.

Safe HaskellSafe-Infered



The Server module of the PupEvents framework is designed to be run from the file that specifies the Events that you are handling. The only thing that would need to be written to use this is the Events file, it does not depend on the application code.





:: Maybe [Char]

The address to listen on, if it's not given default to

-> Int

The number of priority levels to create the PQueue with

-> String

The port to start on

-> (t -> Int)

The function to look up the priority level of an event

-> (t1 -> t1 -> String)

The lookup function to convert an event to a string representation

-> (t -> t -> IO t1)

The lookup function to look up the handler for an event

-> [ParsecT [Char] () Identity t]

The list of parsers to try and parse events with

-> Maybe t

Optional. The event to put on the pqueue when a client disconnects

-> IO b 

The main entry point of the program. This ends by forever calling acceptCon.

handleEvents :: Handle -> PQueue t -> (t1 -> t1 -> String) -> (t -> t -> IO t1) -> IO ()Source

acceptCon :: Socket -> Int -> (t -> Int) -> (t1 -> t1 -> String) -> (t -> t -> IO t1) -> [ParsecT [Char] () Identity t] -> Maybe t -> IO ThreadIdSource

recvEvents :: Handle -> PQueue a -> (a -> Int) -> [ParsecT [Char] () Identity a] -> Maybe a -> IO ()Source