[Haskell-cafe] Re: Lists and monads

Kevin Jardine kevinjardine at gmail.com
Mon Jul 26 09:49:06 EDT 2010


On Jul 26, 3:26 pm, Bill Atkins <watk... at alum.rpi.edu> wrote:
> Can you post an example of your code?

Without getting into the complexities, one simple example is a fold
where the step function returns results in a monad.
I have taken to replacing the fold in that case with a recursive
function, which surely is the wrong approach. I think foldM might do
the job but am unsure.

But as I said, that is just an example. I keep wanting to apply the
usual list tools but find that they do not work inside a monad. I find
myself wishing that f (m [a]) just automatically returned m f([a])
without me needing to do anything but I expect that there are reasons
why that is not a good idea.

Kevin





More information about the Haskell-Cafe mailing list