simple lesson wanted for overloading list

G.W.M. Vissers vissers@theochem.kun.nl
Mon, 14 Feb 2000 09:16:41 +0100 (MET)


You'll have to create the ==-operator for your Greek type. The isMember
function is of type 

isMember::a !.[a] -> .Bool | Eq a

where the part after the | indicates the conditions that have to be met
for type a, in this case that all elements of class Eq a have to be
defined. Since there are only two elements in Eq (== and <>), and since <>
is defined in StdClass using ==, you only have to define the equality. 
> 
> Hi,
> 
> Suppose I have the following abstract type:
> 
> :: Greek = Alpha | Beta | Gamma | Delta | Epsilon
> 
> I want to do
> 
> Start :: Bool
> Start = isMember Alpha [Alpha Beta Gamma]
> 
> but I get the error that isMember has no instance
> 
> How to I overload the StdList operators for an abstact type?
> 
> Thanks,
> 
> Andrew Jonathan Fine
>