irc-0.1: A small library for parsing IRC messagesSource codeContentsIndex
Network.IRC
Portabilitynon-portable (not tested)
Stabilityexperimental
Maintainertrevor@geekgateway.com
Contents
Type Synonyms
IRC Datatypes
Parsing and Formatting Functions
Parsec Combinators for Parsing IRC messages
Other Parser Combinators
Description
library for parsing IRC messages
Synopsis
type Parameter = String
type ServerName = String
type UserName = String
type RealName = String
type Command = String
data Prefix
= Server ServerName
| NickName String (Maybe UserName) (Maybe ServerName)
data Message = Message (Maybe Prefix) Command [Parameter]
parseMessage :: String -> Maybe Message
formatMessage :: Message -> String
translateReply :: Command -> String
prefix :: CharParser st Prefix
server :: CharParser st Prefix
nickname :: CharParser st Prefix
command :: CharParser st Command
parameter :: CharParser st Parameter
message :: CharParser st Message
crlf :: CharParser st ()
spaces :: CharParser st ()
maybeP :: GenParser tok st a -> GenParser tok st (Maybe a)
tokenize :: CharParser st a -> CharParser st a
takeUntil :: String -> CharParser st String
Type Synonyms
type Parameter = StringSource
type ServerName = StringSource
type UserName = StringSource
type RealName = StringSource
type Command = StringSource
IRC Datatypes
data Prefix Source
The optional beginning of an IRC messages
Constructors
Server ServerNameServer Prefix
NickName String (Maybe UserName) (Maybe ServerName)Nickname Prefix
show/hide Instances
data Message Source
IRC messages are parsed as: [ ':' prefix space ] command { space param } crlf
Constructors
Message (Maybe Prefix) Command [Parameter]IRC Message
show/hide Instances
Parsing and Formatting Functions
parseMessageSource
:: StringMessage string
-> Maybe MessageParsed message
Parse a String into a Message.
formatMessageSource
:: MessageIRC Message
-> StringFormatted message
Message formatting
translateReplySource
:: CommandReply
-> StringText translation
Translate a reply into the text version of the reply. If no text version is available, the argument is returned.
Parsec Combinators for Parsing IRC messages
prefix :: CharParser st PrefixSource
Parse a Prefix
server :: CharParser st PrefixSource
Parse a Server prefix
nickname :: CharParser st PrefixSource
Parse a NickName prefix
command :: CharParser st CommandSource
Parse a command. Either a string of capital letters, or 3 digits.
parameter :: CharParser st ParameterSource
Parse a command parameter.
message :: CharParser st MessageSource
Parse a Message
crlf :: CharParser st ()Source
Parse a cr lf
spaces :: CharParser st ()Source
Consume only spaces tabs or the bell character
Other Parser Combinators
maybeP :: GenParser tok st a -> GenParser tok st (Maybe a)Source
Convert a parser into an optional one that returns a Maybe
tokenize :: CharParser st a -> CharParser st aSource
Convert a parser that consumes all space after it
takeUntil :: String -> CharParser st StringSource
Take all tokens until one character from a given string is found
Produced by Haddock version 2.1.0