cvs commit: fptools/libraries/base/Data Monoid.hs

Ross Paterson ross at soi.city.ac.uk
Tue Oct 25 05:11:25 EDT 2005


ross        2005/10/25 02:11:25 PDT

  Modified files:
    libraries/base/Data  Monoid.hs 
  Log:
  Change the Monoid instance for functions (as proposed on the libraries
  list, and interpreting silence as assent) from composition to pointwise
  combination.
  
  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 mailing list