
Thanks to everyone who responded. (-: On Tue, 31 Jul 2001, Ashley Yakeley wrote: (snip)
Clearly the type 'Tree a' is only Show if 'a' is. It's irrelevant that the 'Leaf' part of the definition doesn't need 'a' to be Show: the 'Branch' part does, so the type has to be restricted to 'Show a => Tree a' if it is going to be Show. (snip)
Ah, right. Yes, I guess partly I was indeed confused because the 'Leaf' part of the definition doesn't need 'a' to be Show - I'd been hoping to be able to define that bit without the "Show a =>" requirement. I see now that this reminds me of a previous thing I'd asked where, say, I define: test [a,b] = a>b test _ = False ...and am then surprised at it complaining when I ask the value of test [] I guess the lesson is that I can't just look at a definition and see that it should be easy for Haskell to evaluate something; it still insists on having enough type information for bits of code that aren't being used, and no doubt I'll get used to it in time and figure out when this extra type information is needed. (-: Thanks! -- Mark