diff options
author | Torsten Schmits <git@tryp.io> | 2022-09-21 13:38:55 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-09-21 14:31:24 -0400 |
commit | 2463df2fe21b5b37ecada3df8c6726c534d24590 (patch) | |
tree | 824454d1e2d543da906c2b645365f051b04f3ddc /libraries/base/GHC | |
parent | c0ba775dda6ddec1251363d1b73f4f3e35931dd9 (diff) | |
download | haskell-2463df2fe21b5b37ecada3df8c6726c534d24590.tar.gz |
Rename Solo[constructor] to MkSolo
Part of proposal 475 (https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst)
Moves all tuples to GHC.Tuple.Prim
Updates ghc-prim version (and bumps bounds in dependents)
updates haddock submodule
updates deepseq submodule
updates text submodule
Diffstat (limited to 'libraries/base/GHC')
-rw-r--r-- | libraries/base/GHC/Base.hs | 22 | ||||
-rw-r--r-- | libraries/base/GHC/Enum.hs | 26 | ||||
-rw-r--r-- | libraries/base/GHC/Ix.hs | 8 |
3 files changed, 28 insertions, 28 deletions
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index c63ec1264f..7933205ab5 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -122,7 +122,7 @@ import GHC.Err import GHC.Maybe import {-# SOURCE #-} GHC.IO (mkUserError, mplusIO) -import GHC.Tuple (Solo (..)) -- Note [Depend on GHC.Tuple] +import GHC.Tuple (Solo (MkSolo)) -- Note [Depend on GHC.Tuple] import GHC.Num.Integer () -- Note [Depend on GHC.Num.Integer] -- for 'class Semigroup' @@ -383,12 +383,12 @@ instance Monoid () where -- | @since 4.15 instance Semigroup a => Semigroup (Solo a) where - Solo a <> Solo b = Solo (a <> b) - stimes n (Solo a) = Solo (stimes n a) + MkSolo a <> MkSolo b = MkSolo (a <> b) + stimes n (MkSolo a) = MkSolo (stimes n a) -- | @since 4.15 instance Monoid a => Monoid (Solo a) where - mempty = Solo mempty + mempty = MkSolo mempty -- | @since 4.9.0.0 instance (Semigroup a, Semigroup b) => Semigroup (a, b) where @@ -466,17 +466,17 @@ instance Semigroup a => Monoid (Maybe a) where -- | @since 4.15 instance Applicative Solo where - pure = Solo + pure = MkSolo -- Note: we really want to match strictly here. This lets us write, -- for example, -- -- forceSpine :: Foldable f => f a -> () -- forceSpine xs - -- | Solo r <- traverse_ Solo xs + -- | MkSolo r <- traverse_ MkSolo xs -- = r - Solo f <*> Solo x = Solo (f x) - liftA2 f (Solo x) (Solo y) = Solo (f x y) + MkSolo f <*> MkSolo x = MkSolo (f x) + liftA2 f (MkSolo x) (MkSolo y) = MkSolo (f x y) -- | For tuples, the 'Monoid' constraint on @a@ determines -- how the first values merge. @@ -493,7 +493,7 @@ instance Monoid a => Applicative ((,) a) where -- | @since 4.15 instance Monad Solo where - Solo x >>= f = f x + MkSolo x >>= f = f x -- | @since 4.9.0.0 instance Monoid a => Monad ((,) a) where @@ -1045,12 +1045,12 @@ instance Monad ((->) r) where -- | @since 4.15 instance Functor Solo where - fmap f (Solo a) = Solo (f a) + fmap f (MkSolo a) = MkSolo (f a) -- Being strict in the `Solo` argument here seems most consistent -- with the concept behind `Solo`: always strict in the wrapper and lazy -- in the contents. - x <$ Solo _ = Solo x + x <$ MkSolo _ = MkSolo x -- | @since 2.01 instance Functor ((,) a) where diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs index a050325f17..855d975ca7 100644 --- a/libraries/base/GHC/Enum.hs +++ b/libraries/base/GHC/Enum.hs @@ -279,19 +279,19 @@ instance Enum () where enumFromThenTo () () () = let many = ():many in many instance Enum a => Enum (Solo a) where - succ (Solo a) = Solo (succ a) - pred (Solo a) = Solo (pred a) - - toEnum x = Solo (toEnum x) - - fromEnum (Solo x) = fromEnum x - enumFrom (Solo x) = [Solo a | a <- enumFrom x] - enumFromThen (Solo x) (Solo y) = - [Solo a | a <- enumFromThen x y] - enumFromTo (Solo x) (Solo y) = - [Solo a | a <- enumFromTo x y] - enumFromThenTo (Solo x) (Solo y) (Solo z) = - [Solo a | a <- enumFromThenTo x y z] + succ (MkSolo a) = MkSolo (succ a) + pred (MkSolo a) = MkSolo (pred a) + + toEnum x = MkSolo (toEnum x) + + fromEnum (MkSolo x) = fromEnum x + enumFrom (MkSolo x) = [MkSolo a | a <- enumFrom x] + enumFromThen (MkSolo x) (MkSolo y) = + [MkSolo a | a <- enumFromThen x y] + enumFromTo (MkSolo x) (MkSolo y) = + [MkSolo a | a <- enumFromTo x y] + enumFromThenTo (MkSolo x) (MkSolo y) (MkSolo z) = + [MkSolo a | a <- enumFromThenTo x y z] deriving instance Bounded a => Bounded (Solo a) -- Report requires instances up to 15 diff --git a/libraries/base/GHC/Ix.hs b/libraries/base/GHC/Ix.hs index b523fe2b4f..be02b568a2 100644 --- a/libraries/base/GHC/Ix.hs +++ b/libraries/base/GHC/Ix.hs @@ -271,15 +271,15 @@ instance Ix a => Ix (Solo a) where -- as derived {-# SPECIALISE instance Ix (Solo Int) #-} {-# INLINE range #-} - range (Solo l, Solo u) = - [ Solo i | i <- range (l,u) ] + range (MkSolo l, MkSolo u) = + [ MkSolo i | i <- range (l,u) ] {-# INLINE unsafeIndex #-} - unsafeIndex (Solo l, Solo u) (Solo i) = + unsafeIndex (MkSolo l, MkSolo u) (MkSolo i) = unsafeIndex (l,u) i {-# INLINE inRange #-} - inRange (Solo l, Solo u) (Solo i) = + inRange (MkSolo l, MkSolo u) (MkSolo i) = inRange (l, u) i -- Default method for index |