Typklassen, Beispiel: Show

class Show a where { show :: a -> String }

data Foo = Foo { foo :: Integer }

instance Show Foo where
    show f = "F" ++ show ( foo f )

rshow :: Show a -- Typconstraint
      => a -> String
rshow x = reverse ( show x )



2009-11-20