[trac@galois.com: Re: [GHC] #1218: Add sortNub and sortNubBy to Data.List]

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Mar 23 07:17:23 EDT 2007


On Thu, 2007-03-22 at 12:10 +0100, Nils Anders Danielsson wrote: 
> On Thu, 22 Mar 2007, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> 
> > It's interesting to note that the implementations in base for some
> > functions in Data.List have been inconsistent with the report for years
> > and nobody has noticed (or at least if they noticed they didn't complain
> > very loudly).
> 
> I have certainly found some discrepancies in the past. If you never
> reason about partial or infinite values you're not likely to stumble
> over these inconsistencies, though.

Certainly. I've come across some some very subtle examples that I'd not
have spotted normally.

I came across your ChasingBottoms lib yesterday. It's very nice. I'd
started to implement something similar to test the strictness properties
of our list reimplementation but what you've got is a good deal more
complete. I started by looking at Olaf Chitil's StrictCheck module which
uses your lib however the SYB technique it uses to generate partial
values of various types doesn't help when it comes to function types. So
instead I modified SmallCheck to generate values with bottoms in them.
That copes with function types very nicely. It can generate all the
partial monotone functions up to a given depth ( I think :-) ).

My one gripe with ChasingBottoms is that I can't customise the
ApproxShow instances. I want to show functions in the SmallCheck style
but deal with _|_'s properly. SmallCheck defines a Show instance for
functions that shows the mappings up to a certain depth. It's very cute.
I can't define my own ApproxShow instance for functions since it
overlaps with the Data a => ApproxShow a instance.

Duncan



More information about the Libraries mailing list