cvs commit: fptools/libraries/base/Data Monoid.hs
ross at soi.city.ac.uk
Tue Oct 25 05:11:25 EDT 2005
ross 2005/10/25 02:11:25 PDT
Change the Monoid instance for functions (as proposed on the libraries
list, and interpreting silence as assent) from composition to pointwise
Rationale: The new instance is consistent with the instances for tuples,
it's compositional, in that it builds instances for complex types out
of instances for simpler ones, and it makes this module Haskell 98.
Downside: the old instance was easy to use with Writer monads, and ShowS
was a special case. You can get that effect using the new Endo type,
but you have to wrap and unwrap the newtype.
Also added a few other simple monoids: dual, sum and product.
Revision Changes Path
1.5 +38 -6 fptools/libraries/base/Data/Monoid.hs
More information about the Cvs-libraries