constraints inside classes

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Feb 24 03:02:11 EST 2002


Fri, 22 Feb 2002 12:55:13 -0800, Mark P Jones <mpj at cse.ogi.edu> pisze:

> | class Foo a where
> |         f :: Eq a => a -> Bool
> 
> This behavior of Hugs is intentional, and is documented as a non-bug
> on the Hugs web pages:  (right at the end)
> 
>   http://cvs.haskell.org/Hugs/pages/bugsandfeatures.htm
> 
> I don't know how the "non bug" status was determined, but perhaps
> it reflects a view that the real bug is in the language report,
> where a demonstrably unnecessary, and potentially limiting restriction
> is imposed.

It's indeed limiting and IMHO should be removed; I have told about
it some time ago. Here is a stripped-down example where it's necessary:

class Seq s a where
    fromList :: [a] -> s a
    elem     :: Eq a => a -> s a -> Bool

I've seen attempts at expressing such class with features that GHC
allows but they were all wrong.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK




More information about the Glasgow-haskell-bugs mailing list