Eq instance

eric 2018-03-07 19:35:05.231825 UTC

1-- Write the Eq instance for the datatype provided.
2data Tuple a b =
3 Tuple a b deriving Show
4
5instance (Eq a, Eq b) => Eq (Tuple a b) where
6 (==) (Tuple a b) (Tuple a' b') = a == a' && b == b'
7
8-- ->
9
10*EqInstances> Tuple 1 'a' == Tuple 'a' 1
11
12<interactive>:52:7: error:
13No instance for (Num Char) arising from the literal ‘1’
14In the first argument ofTuple’, namely ‘1’
15 In the first argument of ‘(==)’, namely ‘Tuple 1 'a'
16 In the expression: Tuple 1 'a' == Tuple 'a' 1