
11 Jun
2013
11 Jun
'13
2:51 p.m.
John Wiegley
writes:
4. (Optional, recommended) That we fix the Monoid instance for Maybe to be:
instance Semigroup a => Semigroup (Maybe a) where Just x <> Just y = Just (x <> y) _ <> _ = Nothing
Slight correction (thanks to Brent Yorgey for catching this): instance Semigroup a => Semigroup (Maybe a) where Just x <> Just y = Just (x <> y) Nothing <> x = x x <> Nothing = x -- John Wiegley FP Complete Haskell tools, training and consulting http://fpcomplete.com johnw on #haskell/irc.freenode.net