-- A commonly seen type class used for -- combining things. class MyMonoid a where mempty' :: a mappend' :: a -> a -> a instance MyMonoid Bool where mempty' = True mappend' x y = x && y instance MyMonoid Integer where mempty' = 0 mappend' x y = x + y instance (MyMonoid a) => MyMonoid (Maybe a) where mempty' = Nothing mappend' (Nothing) (Just x) = Just x mappend' (Just y) (Just x) = Just (mappend' y x) mappend' (Just y) (Nothing) = Just y instance MyMonoid [a] where mempty' = [] mappend' = (++)