summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Jakobi <simon.jakobi@gmail.com>2021-02-04 20:13:03 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-13 21:30:45 -0500
commita6c3ddfe388f971ccaec28b43bccbd82a81e83ba (patch)
tree199c547b32a3cf505cc361540411d1983abd8e9c
parenta5ec3515a4a177d4dbda116b68eb810fa62c573f (diff)
downloadhaskell-a6c3ddfe388f971ccaec28b43bccbd82a81e83ba.tar.gz
Remove Data.Semigroup.Option
Bumps the binary and deepseq submodules. Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/15028.
-rw-r--r--libraries/base/Data/Semigroup.hs88
-rw-r--r--libraries/base/changelog.md2
m---------libraries/binary0
m---------libraries/deepseq0
4 files changed, 2 insertions, 88 deletions
diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs
index aaabe97e71..13b1e0e77a 100644
--- a/libraries/base/Data/Semigroup.hs
+++ b/libraries/base/Data/Semigroup.hs
@@ -89,9 +89,6 @@ module Data.Semigroup (
, Any(..)
, Sum(..)
, Product(..)
- -- * A better monoid for Maybe
- , Option(..)
- , option
-- * Difference lists of a semigroup
, diff
, cycle1
@@ -108,7 +105,6 @@ import GHC.Base (Semigroup(..))
import Data.Semigroup.Internal
import Control.Applicative
-import Control.Monad
import Control.Monad.Fix
import Data.Bifoldable
import Data.Bifunctor
@@ -511,87 +507,3 @@ mtimesDefault :: (Integral b, Monoid a) => b -> a -> a
mtimesDefault n x
| n == 0 = mempty
| otherwise = unwrapMonoid (stimes n (WrapMonoid x))
-
-{-# DEPRECATED Option, option "will be removed in GHC 9.2; use 'Maybe' instead." #-}
-
--- | 'Option' is effectively 'Maybe' with a better instance of
--- 'Monoid', built off of an underlying 'Semigroup' instead of an
--- underlying 'Monoid'.
---
--- Ideally, this type would not exist at all and we would just fix the
--- 'Monoid' instance of 'Maybe'.
---
--- In GHC 8.4 and higher, the 'Monoid' instance for 'Maybe' has been
--- corrected to lift a 'Semigroup' instance instead of a 'Monoid'
--- instance. Consequently, this type is no longer useful.
-newtype Option a = Option { getOption :: Maybe a }
- deriving ( Eq -- ^ @since 4.9.0.0
- , Ord -- ^ @since 4.9.0.0
- , Show -- ^ @since 4.9.0.0
- , Read -- ^ @since 4.9.0.0
- , Data -- ^ @since 4.9.0.0
- , Generic -- ^ @since 4.9.0.0
- , Generic1 -- ^ @since 4.9.0.0
- )
-
--- | @since 4.9.0.0
-instance Functor Option where
- fmap f (Option a) = Option (fmap f a)
-
--- | @since 4.9.0.0
-instance Applicative Option where
- pure a = Option (Just a)
- Option a <*> Option b = Option (a <*> b)
- liftA2 f (Option x) (Option y) = Option (liftA2 f x y)
-
- Option Nothing *> _ = Option Nothing
- _ *> b = b
-
--- | @since 4.9.0.0
-instance Monad Option where
- Option (Just a) >>= k = k a
- _ >>= _ = Option Nothing
- (>>) = (*>)
-
--- | @since 4.9.0.0
-instance Alternative Option where
- empty = Option Nothing
- Option Nothing <|> b = b
- a <|> _ = a
-
--- | @since 4.9.0.0
-instance MonadPlus Option
-
--- | @since 4.9.0.0
-instance MonadFix Option where
- mfix f = Option (mfix (getOption . f))
-
--- | @since 4.9.0.0
-instance Foldable Option where
- foldMap f (Option (Just m)) = f m
- foldMap _ (Option Nothing) = mempty
-
--- | @since 4.9.0.0
-instance Traversable Option where
- traverse f (Option (Just a)) = Option . Just <$> f a
- traverse _ (Option Nothing) = pure (Option Nothing)
-
--- | Fold an 'Option' case-wise, just like 'maybe'.
-option :: b -> (a -> b) -> Option a -> b
-option n j (Option m) = maybe n j m
-
--- | @since 4.9.0.0
-instance Semigroup a => Semigroup (Option a) where
- (<>) = coerce ((<>) :: Maybe a -> Maybe a -> Maybe a)
-#if !defined(__HADDOCK_VERSION__)
- -- workaround https://github.com/haskell/haddock/issues/680
- stimes _ (Option Nothing) = Option Nothing
- stimes n (Option (Just a)) = case compare n 0 of
- LT -> errorWithoutStackTrace "stimes: Option, negative multiplier"
- EQ -> Option Nothing
- GT -> Option (Just (stimes n a))
-#endif
-
--- | @since 4.9.0.0
-instance Semigroup a => Monoid (Option a) where
- mempty = Option Nothing
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 7ba14bf36b..02202aaa60 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -18,6 +18,8 @@
* Add `Eq1`, `Read1` and `Show1` instance for `Complex`;
add `Eq1/2`, `Ord1/2`, `Show1/2` and `Read1/2` instances for 3 and 4-tuples.
+ * Remove `Data.Semigroup.Option` and the accompanying `option` function.
+
## 4.15.0.0 *TBA*
* `openFile` now calls the `open` system call with an `interruptible` FFI
diff --git a/libraries/binary b/libraries/binary
-Subproject f797e935ad5bcc082f9cfe4b7a650cf0df3224a
+Subproject 890fcc606d5c9052bdb016d786289dadc29cd46
diff --git a/libraries/deepseq b/libraries/deepseq
-Subproject 0fd7fc88aded7d7a7a1c1250fd3dcd9152edba3
+Subproject 7a5920aaaf6f4f4831a6c7ae28373f29afc7205