Generische Instanzen

instance Show a => Show ( Maybe a ) where
    show m = case m of
        Nothing -> "Nothing"
        Just x  -> "Just" ++ show x

das kann der Compiler selbst:

data Maybe a = ... 
    deriving ( Show )



2009-11-20