
5 Aug
2008
5 Aug
'08
3:28 p.m.
Suppose we have the following: data Foo x list_foo :: [x] -> Foo x foo_list :: Foo x -> [x] What would be the best way to write a Show instance? The thing that I came up with is instance (Show x) => Show (Foo x) where show foo = "list_foo " ++ show (foo_list foo) But apparently you're supposed to use the strange "showsPrec" method that I don't understand. So can somebody show me a correct instance definition for this type please?