23 Dec
2007
23 Dec
'07
6:42 a.m.
Hi Brad,
Experience has taught me to _never_ put class contexts on data definitions. Now you can't write something as simple as "Empty" - you have to give it a class context. This is just plain annoying.
With the class context in the BST definition, ghc gives no complaints when I evaluate "Empty":
In some circumstances, you need to give a type sig. For example using Hugs: Main> Empty ERROR - Cannot find "show" function for: *** Expression : Empty *** Of type : BST a I guess GHC has enough defaulting to display this anyway. You'll also have the dreaded-evil-horrid monomorhpism restriction if you type. empty = Empty Thanks Neil