[Haskell-cafe] Generalizing IO

Floptical Logic flopticalogic at gmail.com
Mon Oct 5 23:54:29 EDT 2009

> Instead of specifying the monad implementation, specify the interface.
> That is, you are using state operations (from MonadState) and IO
> operations (from MonadIO). Try removing all the type signatures that
> mention PDState and see what you get.
> E.g., loop :: (MonadState PD m, MonadIO m) => m a

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?

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?


More information about the Haskell-Cafe mailing list