[Haskell-cafe] foldr (.) id

John Wiegley johnw at newartisans.com
Fri Oct 26 21:31:34 CEST 2012


>>>>> 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




More information about the Haskell-Cafe mailing list