[Haskell-cafe] tips on using monads

Claus Reinke claus.reinke at talk21.com
Mon May 18 07:20:25 EDT 2009


> I've got one of those algorithms which "threatens to march off the right edge" (in the words of 
> Goerzen et al). I need something like a State or Maybe monad, but this is inside the IO monad. So 
> I presume I need StateT or MaybeT. However, I'm still (slowly) learning about monads from first 
> principles. I thought I might present my code and get some pointers... maybe someone could 
> actually show me how to rewrite it, which would be a neat way to see MaybeT and StateT in action. 
> I'm hoping to get anything from a one-line response to a rewrite of my code. Anything will help.

Perhaps this is useful:
http://www.haskell.org/haskellwiki/Equational_reasoning_examples#Coding_style:_indentation_creep_with_nested_Maybe

Claus 



More information about the Haskell-Cafe mailing list