[Haskell-cafe] Generalizing IO

Antoine Latter aslatter at gmail.com
Tue Oct 6 00:08:37 EDT 2009

On Mon, Oct 5, 2009 at 10:54 PM, Floptical Logic
<flopticalogic at gmail.com> wrote:
> If I were to make an instance of MonadIO be a parameter to StateT and
> I wanted to use the Net monad (from Roll your own IRC bot on the wiki)
> with it, I would need to make Net an instance of MonadIO.  What would
> this instance look like?

If you define 'Net' as in the tutorial above, it will already be an
instance of MonadIO :-)

> I think the loop function is the least of my worries.  I am more
> concerned about the runCmd function.  What would go in place of print
> in runCmd?

The function 'liftIO . print' will work in any monad which is an
instance of MonadIO. Take a look at
for where 'liftIO' comes from.


More information about the Haskell-Cafe mailing list