On 2005-02-07 20:36:55 +0000, pablo daniel rey wrote:
> data Dir = Left | Right | Up | Down
> data Piece = Vertical | Horizontal | CodeA | CodeB
>> the error i get :
>> Instances of (Eq Dir, Eq Piece) required for definition of chgDir
You try to compare Dir and Piece values without having told Haskell
how the comparison should work. Haskell doesn't provide a default
comparison funcition even for the really obvious cases like this,
unless you tell it to using the "deriving" keyword:
data Bool = False | True deriving (Eq,Ord,Show,Read)
In your case, all you need is Eq, so you can skip the parentheses.
--
Karl Hasselström, kha at treskal.com
www.treskal.com/kalle