We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cb60199 + d50a8fb commit 7d20791Copy full SHA for 7d20791
src/Data/Maybe.purs
@@ -199,12 +199,14 @@ instance invariantMaybe :: Invariant Maybe where
199
-- |
200
-- | ``` purescript
201
-- | Just x <> Just y = Just (x <> y)
202
--- | Just x <> Nothing = Nothing
203
--- | Nothing <> Just y = Nothing
+-- | Just x <> Nothing = Just x
+-- | Nothing <> Just y = Just y
204
-- | Nothing <> Nothing = Nothing
205
-- | ```
206
instance semigroupMaybe :: (Semigroup a) => Semigroup (Maybe a) where
207
- append x y = append <$> x <*> y
+ append Nothing y = y
208
+ append x Nothing = x
209
+ append (Just x) (Just y) = Just (x <> y)
210
211
instance monoidMaybe :: (Semigroup a) => Monoid (Maybe a) where
212
mempty = Nothing
0 commit comments