Перейти до Домашньої сторінки Груп Google    comp.lang.haskell
Overwrite implementation of show function

Frank Poettgen <frank.poett...@post.rxwytxh-ayazcyhzeyn.de>

import Data.Set as Set ( Set, fromList, toList )

test = fromList [fromList [1,2],fromList [3]]

Then 'show test' will result in the following string:
"fromList [fromList [1,2],fromList [3]]"

What I want is something like "[[1,2],[3]]"
Is there a way to overwrite the implementation of the show function?

instance (Show a) => Show (Set a) where
   show x = toList x

-> ERROR Overlapping instances for class "Show"