[clean-list] How can I define an equality test ?

Ben Lippmeier Ben.Lippmeier at anu.edu.au
Mon Nov 26 00:44:11 MET 2007


Hi Ferreria
I had the same problem some time ago. You can use the clean generics 
library to derive the equality operator (===) that you want. See the 
mail archive at: 
http://mailman.science.ru.nl/pipermail/clean-list/2004/002702.html

Ferreira Maurizio wrote:
> Im trying to define the == operator
> with  an algebraic data type.
> How can I define it ?
> what have I to write i the following example, instead of ????
> Regards
> maurizio
>
>
> module test
> import StdEnv
>
> :: Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun 
>
> instance == Day
> where
>   (==) :: Day Day -> Bool
>   (==) x y = x ????? y   ////  what have I to write ?
>   
> IsGood :: Day -> Bool
> IsGood x = x == Mon
>
> Start = IsGood Mon  
>
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
>   



More information about the clean-list mailing list