Endo-Monoid of lists = differences lists

Henning Thielemann lemming at henning-thielemann.de
Fri Jan 2 09:47:15 EST 2009


How about a function for the Endo monoid, that lifts from a single value.

toEndo :: (Monoid a) => a -> Endo a
toEndo x = Endo (mappend x)

For 'a' being a list type one would have a nice difference list. This may 
also occur in the documentation - both in the ones of Monoid.Endo and the 
of http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dlist . 
A similar application is Peano number with efficient addition. Would also 
be a nice type for ShowS.


More information about the Libraries mailing list