[Haskell-cafe] foldr (.) id
Thiago Negri
evohunz at gmail.com
Fri Oct 26 21:56:32 CEST 2012
Can you please show some examples where it might be useful?
I miss the point.
Thanks,
Thiago.
2012/10/26 John Wiegley <johnw at newartisans.com>:
>>>>>> Greg Fitzgerald <garious at gmail.com> writes:
>
>> I've recently found myself using the expression: "foldr (.) id" to compose a
>> list (or Foldable) of functions.
>
> You want the Endo monoid:
>
> ghci> appEndo (Endo (+ 10) <> Endo (+ 20)) $ 3
> 33
>
> John
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list