1) Here is my code, the find function needs to take a (Node a) and a type (a) as parameters but my function definition doesn't seem to work, what am I doing wrong? Little info on the net that I can find, so thanks for any help!
2) When my find function is implemented I'll need to access a specific variable in a Node, how do I do this?!?
-- int for comparisons
find :: (Node a) => Node a -> a -> Bool
find n s
| s == "asd" = True
| s /= "asd" = False
data Node a = Node a (Node a) (Node a)
| Empty
myTree = Node "parent" (Node "left" Empty Empty)
(Node "right" Empty Empty)
Here is the error message I get:
Type constructor `Node' used as a class
In the type `(Node a) => Node a -> a -> Bool'
In the type signature for `find':
find :: (Node a) => Node a -> a -> Bool
Failed, modules loaded: none.
I'm obviously still learning this so an explanation of the solutions would also be appreciated, thankyou!