[Haskell-cafe] Still stacking monad transformers

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Oct 12 13:18:19 EDT 2008

On Sun, 2008-10-12 at 18:08 +0100, Andrew Coppin wrote:
> 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 
> monad:
>   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?

Have you tried pure lazy functional programming without stacked monads?

I've never been convinced that stacked monads is a good way to write
ordinary code. Monad transformers are great for building your own custom
monads but they should be wrapped in a newtype and made abstract. One
shouldn't have to see the multiple layers. If ordinary code is full of
'lift' then it would seem to me that one is doing something wrong.


More information about the Haskell-Cafe mailing list