[Haskell-cafe] cost of List.// for Ord types?

Fergus Henderson fjh007 at galois.com
Tue Sep 7 15:07:43 EDT 2004

On 03-Sep-2004, David Roundy <droundy at droundy.dyndns.org> wrote:
> I was wondering if the list diff operator \\ takes advantage of situations
> where the list data type is in class Ord, besides being in Eq.

No, it cannot, at least not in the general case.
The interface for "\\" says that it only depends on the Eq class;
calling Ord member functions would not have the right semantics.

> Basically, I'm wondering if I should avoid using the standard library \\,

If efficiency is a significant concern, and the lists involved may be long,
yes, you should.

Fergus J. Henderson                 |  "I have always known that the pursuit
Galois Connections, Inc.            |  of excellence is a lethal habit"
Phone: +1 503 626 6616              |     -- the last words of T. S. Garp.

More information about the Haskell-Cafe mailing list