Re: Doing exercises from "Haskell tutorial" ...

02 Oct 2001 15:16:27 +0300, Dmitry Astapov
I need to define SetsAsLists as an instance of Set by supplying definitions for all Set methods, but definitions I wrote led me to adding additional constraints on "union" and "memeber" methods.
What constraints? The class already says that these operations require Eq on the element type:
class Set s where empty :: s a isEmpty :: s a -> Bool singleton :: a -> s a union :: Eq a => s a -> s a -> s a ^^^^ member :: Eq a => a -> s a -> Bool ^^^^ choice :: s a -> (a, s a)
-- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK

MK> 02 Oct 2001 15:16:27 +0300, Dmitry Astapov
I need to define SetsAsLists as an instance of Set by supplying definitions for all Set methods, but definitions I wrote led me to adding additional constraints on "union" and "memeber" methods.
MK> What constraints? The class already says that these operations require MK> Eq on the element type: [skip] Yes, they already there, but only because I placed them there. Original text from Tutorial does not have these constraints. -- Dmitry Astapov //ADEpt E-mail: adept@umc.com.ua GPG KeyID/fprint: F5D7639D/CA36 E6C4 815D 434D 0498 2B08 7867 4860 F5D7 639D
participants (2)
-
Dmitry Astapov
-
Marcin 'Qrczak' Kowalczyk