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


along with detailed documentation and a few examples here:


As you can see, the code is short and depends only upon the GHC base

The original thread discussing the polyToMonoid idea is here:


Comments and suggestions for improvement are welcome!


More information about the Haskell-Cafe mailing list