
6 Aug
2008
6 Aug
'08
2:06 p.m.
Jonathan Cast wrote:
instance Show x => Show (Foo x) where showsPrec n foo = ("list_foo "++) . shows (foo_list foo)
You use the n parameter if you've got an infix operator in your syntax and you want to put parentheses around an instance of it if n has the wrong value (either too high or too low, I can never remember).
OK. So... should the call to shows actually be showsPrec? Or does it not matter in this case? Actually, now that I think of it, my *next* problem is going to be writing a matching Read instance...