Haskell 98 Report

Alastair David Reid reid@cs.utah.edu
31 May 2001 16:10:43 -0600


Fergus Henderson <fjh@cs.mu.oz.au> writes:
> (It would be good for someone, perhaps Simon P-J., to keep a
> list of issues like this which have been left out of Haskell 98
> due to backwards compatibility concerns, so that they don't get
> forgotten about when it comes to time for the next version.)

Such a list would indeed be useful but I think it's important that the
list should record that there are reasons besides backwards
compatability for leaving things as they are.

IIRC, at the time that the functions were added to List, someone
proposed generalisations like those currently on the table but they
were rejected because they made it harder to state the relationship
between the By functions and their overloaded brethren.  With things
as they are now, the relationship between the By functions and their
overloaded variants is very, very simple to state:

  if foo has type

     foo :: (Eq a) => ty

  then fooBy has type

     fooBy :: (a -> a -> Bool) -> ty

  (where the additional argument is expected to be an equivalence relation)
  and

     foo = fooBy (==)

and

  if foo has type

     foo :: (Ord a) => ty

  then fooBy has type

     fooBy :: (a -> a -> Bool) -> ty

  (where the additional argument is expected to be an reflexive,
  transitive relation) and

     foo = fooBy (<=)

Making the types of the By functions as general as possible would
break the consistency of this story.

-- 
Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/