Irc-0.1.0.1

Safe HaskellNone
LanguageHaskell2010

Irc

Description

Irc is a monadic DSL and library for writing Irc bots. It conveniently utilizes 'do' notation in the style of Shake

Synopsis

Documentation

data Config Source

The Config struct represents the Irc configuration

Constructors

Config 

Fields

server :: String
 
port :: Integer
 
chan :: String
 
nick :: String
 

mainWithConfigAndBehavior :: Config -> Behavior -> IO () Source

Set up actions to run on start and end, and run the main loop. as an example:

main :: IO ()
main = mainWithConfigAndBehavior (Config
                                 "irc.freenode.org"
                                 6667
                                 "#yunbot-testing"
                                 "yunbot") $ do
        "!echo " |! return . drop 6
        "!reverse " |! return . reverse . drop 9

(|!) :: Behavior -> (String -> IO String) -> Behavior infixl 8 Source

(|!) is a infix API to add a rule to a Behavior monad

>>> "pattern1" |! return >> "pattern2" |! return
["pattern1","pattern2"]
>>> "pattern1" |! return >> "pattern2" |! return >> "pattern3" |! return
["pattern1","pattern2","pattern3"]