[Haskell-cafe] Capped lists and |append|

John Millikin jmillikin at gmail.com
Sat Jan 9 00:10:38 EST 2010


Everything here makes much more sense than the previous implementation
-- I've upped 1.2, which splits up |append|, implements the instances
in terms of Monoid, etc.

Also included is |toList| and |toList_| , which are like functions
defined in Felipe's earlier email to me. The first returns the cap and
values, the second only the values.

Last (but not least), some of the |append*| functions are now defined
in terms of |appendWith| from Twan van Laarhoven's email. For example,
|appendM = appendWith mappend|.

On Fri, Jan 8, 2010 at 17:57, Felipe Lessa <felipe.lessa at gmail.com> wrote:
> Of course, you would have to change your 'empty' package to
> include the following law:
>
>  "For every data type implementing Empty and Monoid,
>   empty should be mempty."

"empty" turned out to be a dumb idea -- I had hoped to use it for
types which support a NIL value but not appending. Turns out, there's
not much point to lists which can't be appended. C'est la vie.

> Also, you may want to have CappedList an instance of
> Control.Functor.Bifunctor from category-extras:
> [...]

This is probably a good idea, but, I am nervous about making such a
small package depend on the huge category-extras and mtl.


More information about the Haskell-Cafe mailing list