[Haskell-cafe] Monad fold

Lyndon Maydwell maydwell at gmail.com
Tue Apr 16 14:55:52 CEST 2013


Wow looks like this Monoid instance isn't included in Control.Monad... My
mistake.


On Tue, Apr 16, 2013 at 8:47 PM, Lyndon Maydwell <maydwell at gmail.com> wrote:

> You could do:
>
> runKleisli . mconcat . map Kleisli :: Monoid (Kleisli m a b) => [a -> m b]
> -> a -> m b
>
> Would that work for you?
>
>
> On Tue, Apr 16, 2013 at 8:35 PM, Christopher Howard <
> christopher.howard at frigidcode.com> wrote:
>
>> So, I'm doing something like this
>>
>> foldl (>>=) someA list :: Monad m => m a
>>
>> where
>>   list :: Monad m => [a -> m a],
>>   someA :: Monad m => m a
>>
>> Is there a more concise way to write this? I don't think foldM is what I
>> want -- or is it?
>>
>> --
>> frigidcode.com
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130416/c3406af4/attachment.htm>


More information about the Haskell-Cafe mailing list