[Haskell-cafe] New Eq instance

rodrigo.bonifacio rodrigo.bonifacio at uol.com.br
Thu Aug 9 09:59:43 EDT 2007


I had defined the follwing data type:

data Step = Step Id Scenario Action State Response

How can I define Step as an "Eq Instance", in such way that two steps are equals if they have the same Id (Id is defined as a synonimous for the String type).

I tried the following code, but something is wrong....

instance Eq Step where 
  Step id1 scenario1 action1 state1 response1 == Step id2 scenario2 action2 state2 response2 = id == id
  _ == _ = False
ps.: sorry, this kind of basic question can be sent to this list?

Thanks in advance.


More information about the Haskell-Cafe mailing list