
6 Oct
2009
6 Oct
'09
11:22 a.m.
class StreamMonad m where fetchLine = m sendLine = String -> m ()
instance StreamMonad IO where fetchLine = getLine sendLine = putLine
fetchLineFromStream = lift fetchLine sendLineToStream = lift . sendLine
This approach makes more sense to me. The equivalent to printing something to the screen in the Net (IRC) monad is privmsg and it is easy to make that connection using type classes. I don't see how to make this connection using MonadIO.