Свой Monoid
unknown
haskell
3 years ago
304 B
18
Indexable
newtype Maybe' a = Maybe' { getMaybe :: Maybe a }
deriving (Eq,Show)
instance Monoid a => Monoid (Maybe' a) where
mempty = Maybe' (Just mempty)
Maybe' Nothing `mappend` m = m
m `mappend` Maybe' Nothing = m
Maybe' (Just m1) `mappend` Maybe' (Just m2) = Maybe' (Just (m1 `mappend` m2))Editor is loading...