1 May
2003
1 May
'03
1:38 a.m.
James Grist writes: | ok, | I've got a prob with this 'ere piece of code | there is no Show instance for Tree, so I anticipated | the result of typing... | | Nil | | at the hugs console, which was... | | ERROR - Cannot find "show" function for: | *** Expression : Nil | *** Of type : Tree a This is a variation on a frequently asked question: why does typing [] at the prompt cause an error message? You _do_ have a Show instance for Tree, thanks to your 'deriving Show' clause. The problem here is that hugs doesn't know what the type variable 'a' stands for. If it's a non-showable type, such as a function or an IO action, then 'Tree a' isn't showable either. Try it with a type signature: Nil :: Tree ()