diff options
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 |