[Haskell-cafe] ANNOUNCE: polyToMonoid
Kevin Jardine
kevinjardine at gmail.com
Thu Oct 14 16:40:54 EDT 2010
Polyvariadic functions that accept an indefinite number of possibly
multiple typed arguments are often useful but a bit difficult to
declare in Haskell. With some crucial assistance from Oleg Kiselyov,
I have created a library that supplies two very general polyvariadic
functions that can map their arguments into any monoid you specify.
All you need to do to use these is to specify the monoid and some
instances of a toMonoid function to map all the types you want to pass
as arguments into the monoid.
The functions can act as a sort of generalised list, but of course
there are also many interesting monoids which are not lists.
The library is now up on Hackage here:
http://hackage.haskell.org/package/polyToMonoid-0.1
along with detailed documentation and a few examples here:
http://hackage.haskell.org/packages/archive/polyToMonoid/0.1/doc/html/Data-PolyToMonoid.html
As you can see, the code is short and depends only upon the GHC base
library.
The original thread discussing the polyToMonoid idea is here:
http://groups.google.com/group/haskell-cafe/browse_thread/thread/737c6cf921b99e85
Comments and suggestions for improvement are welcome!
Kevin
More information about the Haskell-Cafe
mailing list