Skip to content

Commit 7d20791

Browse files
committed
Merge pull request #14 from purescript/semigroup-behaviour
Put back the original semigroup behaviour
2 parents cb60199 + d50a8fb commit 7d20791

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Data/Maybe.purs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,14 @@ instance invariantMaybe :: Invariant Maybe where
199199
-- |
200200
-- | ``` purescript
201201
-- | Just x <> Just y = Just (x <> y)
202-
-- | Just x <> Nothing = Nothing
203-
-- | Nothing <> Just y = Nothing
202+
-- | Just x <> Nothing = Just x
203+
-- | Nothing <> Just y = Just y
204204
-- | Nothing <> Nothing = Nothing
205205
-- | ```
206206
instance semigroupMaybe :: (Semigroup a) => Semigroup (Maybe a) where
207-
append x y = append <$> x <*> y
207+
append Nothing y = y
208+
append x Nothing = x
209+
append (Just x) (Just y) = Just (x <> y)
208210

209211
instance monoidMaybe :: (Semigroup a) => Monoid (Maybe a) where
210212
mempty = Nothing

0 commit comments

Comments
 (0)