Method contexts
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sat Feb 10 13:58:06 EST 2001
Sat, 10 Feb 2001 19:04:33 +0100, Hannah Schroeter <uk1o at rz.uni-karlsruhe.de> pisze:
> So you can equally say:
>
> class Eq k => Member c k where
> member :: c -> k -> Bool
>
> class Seq c k where -- no member superclass here
> list :: c -> [k]
This requires listing Member separately in contexts which have Seq
anyway - in other words this requires that the programmer using these
classes knows the class Member, instead of using Seq (and others
which have Member as superclasses too).
This requires listing Eq separately in Member instances.
This requires splitting a class like Member into two when some methods
need different contexts than others.
*Why* to make the restriction that method's context must constrain
at least one type variable quantified in the method's type? What do
we gain by having this restriction? Hugs does not enforce it.
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTÊPCZA
QRCZAK
More information about the Glasgow-haskell-bugs
mailing list