[Haskell-cafe] Generalizing IO
Floptical Logic
flopticalogic at gmail.com
Tue Oct 6 11:22:58 EDT 2009
> 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.
More information about the Haskell-Cafe
mailing list