I'm making a general purpose N-ary tree and im coming up with "unexpected '=' on line 17" as an error. I have spent a fair while trying to work out why this isn't accepting the case that an Empty gtree returns false for any member search. i realise this is probably a very trivial error but any help would be appreciated:
module GTrees where
data Gtree = Empty |
Leaf String |
Node String [Gtree]
deriving (Show)
--Tests if a given string is a member of the tree
gtreeMember :: (Ord a) => a -> Gtree a -> Bool
gtreeMember y Empty = False -- line 17
gtreeMember y (Leaf x) = (x==y)
gtreeMember y (Node x tree)
|x==y = True
|otherwise gtreeMember tree
This is the code up to the point of the error with the error line highlighted