Konstruktorklassen (Functor)

class Functor c where
    fmap :: ( a -> b ) -> ( c a -> c b )

instance Functor [] where
    fmap f l = case l of
        [] -> []
        x : xs -> f x : fmap f xs

instance Functor Maybe where ...

instance Functor Tree where ...
unterscheide von:
instance Show a => Show (Tree a) where ...



2009-11-20