Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

deriving in Clean

2 views
Skip to first unread message

Stephan Haugh

unread,
Mar 1, 2003, 5:14:16 PM3/1/03
to
Sorry this is a real newbie question. I am sure it is the Clean book,
only I can't seem to find it. Searched all over the web too.

I have declared a new datatype in clean

::DataType = BoolData | StringData | IntData

Now, how would I compare two instances of this new type? In Haskell I
would write it like this:

> data DataType
> = BoolData | StringData | IntData
> deriving (Eq, Read, Show)

and away I go. I can now use == to compare two instances of this type.

So I wonder how to achieve that in Clean. All I managed so far is
defining instances of (==) for this new type. That is a bit
long-winded. Any help appreciated.

Cheers, Stephan

Fabien Todescato

unread,
Mar 2, 2003, 1:37:00 PM3/2/03
to
Hi Stephan,

AFAIK, as of version 2.0.2, Clean supports generic programming that you may want
to use to support automatic derivation of ==.

Best regards, Fabien

Steffen Haugk

unread,
Mar 6, 2003, 8:05:55 AM3/6/03
to
Thank you. I have seen chapter 7 in the new Clean report. My
conclusion is that it is nowhere near as simple as it is in Haskell.
Thanks,
Steffen
0 new messages