[Haskell-cafe] ANN: list-extras 0.1.0
wren ng thornton
wren at freegeek.org
Tue Jul 22 22:46:01 EDT 2008
I'm pleased to announce the initial version of list-extras, a home for
common not-so-common list functions.
There are many simple but non-trivial functions for lists which
Data.List lacks. Typically we write a version and include it in a larger
project or store it in a local source tree for personal jobs. But
neither of these approaches makes it easy to distribute the code and
take advantage of open-source development for improving the code. Since
I had code from both approaches, I'm taking the first step and putting a
package out there. So far it's not too large though I'll be adding
things as they come up. If you have functions you think would belong,
feel free to contact me.
This module provides the "Prelude" but removing all the list
functions. This is helpful for modules that overload those function
names to work for other types.
This module provides least-strict functions for getting a list's
length and doing natural things with it. On GHC this module also uses
rewrite rules to convert certain calls to 'length' into our least-strict
versions. [We could do this inefficiently by defining a version of
'length' which returns a Peano integer, but this module is more efficient.]
This module provides safe zipping functions which will fail (return
'Nothing') on uneven length lists. [We could do this by getting the
lengths first and comparing, but this module is less strict when the
lengths are uneven, and we only traverse the lists once.]
This module provides variants of the 'maximum' and 'minimum'
functions which return the element for which some function is maximized
or minimized. [We could do this by a decorate-fold-undecorate pattern,
but this version is more space efficient.]
Links to the hackage and darcs copies of list-extras can be found at:
More information about the Haskell-Cafe