Generische Instanzen (II)

class Show a where
    show ::  a -> String

instance Show a => Show [a] where
    show [] = "[]"
    show xs = brackets 
            $ concat
            $ intersperse "," 
            $ map show xs

show 1 = "1"
show [1,2,3] = "[1,2,3]"



Johannes Waldmann 2010-01-25