Hi,
I am trying to write my own simplified class and instances for equality.
I have trouble with the equality equation for the empty list.
Even though I can use the [] == [] at the GHCi prompt I cannot use it in my equality test.
How can I make my eq test handle empty lists while staying within the context of my current code?.
Thanks,
Pat

class Eq1 a where
 eq :: a -> a -> Bool
 
instance Eq1 Int where
 eq a b =  a == b

instance Eq1 a => Eq1 [a] where
-- This line compiles but gives an run time error.
 eq [] [] =  True
 -- This line does not compile
 -- eq [] [] = [] == []
 -- Where RHS seems acceptable at the GHCi  prompt
 eq (x:xs) (y:ys) = eq x y && eq xs ys
 eq _ _ = False

{-

 {- All tests except the last one run:
 eq [1::Int,2::Int,3::Int] [1::Int,2::Int,3::Int]
 eq (1::Int) (2::Int)
 eq (1::Int) (2::Int)
 eq ((1::Int):(2::Int):[]) ((1::Int):(2::Int):[])
 eq ((1::Int):(2::Int):[]) ((2::Int):(2::Int):[])
 eq [] []
-}