On Mon, Oct 5, 2009 at 7:56 PM, Floptical Logic <flopticalo...@gmail.com> wrote: > The code below is a little interactive program that uses some state. > It uses StateT with IO to keep state. My question is: what is the > best way to generalize this program to work with any IO-like > monad/medium? For example, I would like the program to function as it > does now using stdin but I would also like it to function over IRC > using the Net monad from > <http://haskell.org/haskellwiki/Roll_your_own_IRC_bot>. Thanks for > any suggestions.
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 -- Dave Menendez <d...@zednenem.com> <http://www.eyrie.org/~zednenem/> _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe