Doing exercises from "Haskell tutorial" ...
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
2 Oct 2001 18:18:29 GMT
02 Oct 2001 15:16:27 +0300, Dmitry Astapov <adept@umc.com.ua> pisze:
> 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