[Haskell-cafe] Still stacking monad transformers

Andrew Coppin andrewcoppin at btinternet.com
Sun Oct 12 13:08:22 EDT 2008

I am becoming extremely frustrated now. The task I want to perform is 
simple, yet I simply cannot make Haskell do what I want.

I've given up hope of ever getting my program to handle infinite result 
sets. That means I can make do with just ListT. So I have the following 

  type MyMonad x = StateT MyState (ListT Identity) x

Now I'm trying to run two computations, starting from _the same state_, 
and combine the two resulting lists. The trouble is, I am literally 
losing the will to live trying to comprehend the whinings of the type 
checker. The operation I'm trying to perform is perfectly simple; I 
don't understand why this has to be so damned *difficult*! >_<

Any suggestions?

I found that by using the brief and easily memorable construction 
"runIdentity $ runListT $ runStateT foo state" I can get at the result 
set for each action, and combine them. But nothing in hell seems to 
transform this from [((), MyState)] back into MyMonad ().

More information about the Haskell-Cafe mailing list