definition module IRC
-from Data.Either import :: Either
from Data.Maybe import :: Maybe
from StdOverloaded import class fromInt, class toInt, class toString
| INFO (Maybe String)
| INVITE String String
| ISON [String]
- | JOIN (Either () [(String, Maybe String)])
+ | JOIN [(String, Maybe String)]
| KICK String String (Maybe String)
| KILL String String
| LINKS (Maybe (Maybe String, String))
implementation module IRC
+import StdList
import GenPrint
import StdOverloaded
import Data.Maybe
//INFO (Maybe String)
//INVITE String String
//ISON [String]
- JOIN chs = "JOIN " +++ either (const "0")
- (\c->join ", " [join " " [ch:maybeToList mkey]\\(ch, mkey)<-c]) chs
+ JOIN chs = "JOIN " +++ (if (isEmpty chs) "0"
+ (join ", " [join " " [ch:maybeToList mk]\\(ch, mk)<-chs]))
//KICK String String (Maybe String)
//KILL String String
//LINKS (Maybe (Maybe String, String))
Start = map toString
[NICK "clooglebot"
,USER "cloogle" 0 "Cloogle bot"
- ,JOIN $ Right [("#cloogle", Nothing)]
+ ,JOIN [("#cloogle", Nothing)]
,PRIVMSG "#cloogle" "Hello world"
,QUIT Nothing
]