Re: [Haskell-cafe] ANN: data-ordlist-0.2

2010-02-07 Thread Ross Paterson
Why not wrap lists as Set and Bag abstract datatypes?  An added bonus
is that you could make them instances of Monoid.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: data-ordlist-0.2

2010-02-07 Thread Leon Smith
On Sun, Feb 7, 2010 at 6:43 AM, Ross Paterson r...@soi.city.ac.uk wrote:

 Why not wrap lists as Set and Bag abstract datatypes?  An added bonus
 is that you could make them instances of Monoid.

Well,  my current thinking is that if you really want an abstract
datatype for bags and sets,  hackage (and the standard GHC
distribution) offer a multitude of options.   Previous versions of the
code in data-ordlist dates back 9 years or more;  I extracted and
refurbished data-ordlist from a mess of miscellaneous list functions I
use.

Personally,  I've never really used this code as an abstract datatype;
 my typical use cases break the set and bag abstractions to some
extent. I use a few functions when I happen to know the lists I'm
dealing with are ordered,  and want a simple and efficient way to
manipulate them.  The functions I most often use are sortOn,  sortOn',
 nubSort,  and to a somewhat lesser extent,  the set-like operators.

I put this package on hackage as much for my own personal convenience
as for others;  but I do hope that other people will find it useful.
I realize that others might use it in rather different ways than I do,
 and am open to suggestions and proposals.

Cheers,
Leon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: data-ordlist-0.2

2010-02-06 Thread Leon Smith
I have released data-ordlist 0.2,  with a number of changes:

1.  The module name is now Data.List.Ordered,  instead of Data.OrdList

2.  Three bugfixes: (ack!)  insertSet and insertBag assumed reverse-ordered
lists,   nub failed to remove duplicates.   Thanks to Topi Karvonen for
reporting the first problem.

3.  One semantic change:  old_nubBy f == new_nubBy (not . f).   The new
version is better keeping with the spirit of the rest of the library,  and
makes the old nub bug much more obvious.  Now nubBy is the greedy algorithm
that returns a sublist such that for all binary predicates:

   isSortedBy pred (nubBy pred xs) == True

4.  Improved documentation,  I hope!   Please consider taking a look and
letting me know what you think.

http://hackage.haskell.org/package/data-ordlist

Cheers,
Leon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe