Advertisement
madetara

wtf haskell 2

May 16th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. newtype Box a = Box { getMaybe :: Maybe a }
  2.     deriving (Eq,Show)
  3.  
  4. instance Monoid a => Monoid (Box a) where
  5.     mempty = Box $ Just mempty
  6.     mappend (Box Nothing) a = Box Nothing
  7.     mappend a (Box Nothing) = Box Nothing
  8.     mappend (Box a) (Box b) = Box $ mappend a b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement