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 | |
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
55 files changed, 382 insertions, 337 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs index 35ed69105a..7daba318ef 100644 --- a/compiler/GHC/Builtin/Names.hs +++ b/compiler/GHC/Builtin/Names.hs @@ -50,7 +50,7 @@ occur. We have to be careful about this in exactly two places: This is accomplished through a combination of mechanisms: 1. When parsing source code, the RdrName-decorated AST has some - RdrNames which are Exact. These are wired-in RdrNames where the + RdrNames which are Exact. These are wired-in RdrNames where we could directly tell from the parsed syntax what Name to use. For example, when we parse a [] in a type we can just insert an Exact RdrName Name with the listTyConKey. @@ -538,7 +538,7 @@ gHC_PRIM, gHC_PRIM_PANIC, gHC_PRIM_EXCEPTION, gHC_GHCI, gHC_GHCI_HELPERS, gHC_CSTRING, gHC_SHOW, gHC_READ, gHC_NUM, gHC_MAYBE, gHC_NUM_INTEGER, gHC_NUM_NATURAL, gHC_NUM_BIGNAT, - gHC_LIST, gHC_TUPLE, dATA_EITHER, dATA_VOID, dATA_LIST, dATA_STRING, + gHC_LIST, gHC_TUPLE, gHC_TUPLE_PRIM, dATA_EITHER, dATA_VOID, dATA_LIST, dATA_STRING, dATA_FOLDABLE, dATA_TRAVERSABLE, gHC_CONC, gHC_IO, gHC_IO_Exception, gHC_ST, gHC_IX, gHC_STABLE, gHC_PTR, gHC_ERR, gHC_REAL, @@ -573,6 +573,7 @@ gHC_NUM_NATURAL = mkBignumModule (fsLit "GHC.Num.Natural") gHC_NUM_BIGNAT = mkBignumModule (fsLit "GHC.Num.BigNat") gHC_LIST = mkBaseModule (fsLit "GHC.List") gHC_TUPLE = mkPrimModule (fsLit "GHC.Tuple") +gHC_TUPLE_PRIM = mkPrimModule (fsLit "GHC.Tuple.Prim") dATA_EITHER = mkBaseModule (fsLit "Data.Either") dATA_VOID = mkBaseModule (fsLit "Data.Void") dATA_LIST = mkBaseModule (fsLit "Data.List") diff --git a/compiler/GHC/Builtin/Types.hs b/compiler/GHC/Builtin/Types.hs index 378f348b61..85bdd334c9 100644 --- a/compiler/GHC/Builtin/Types.hs +++ b/compiler/GHC/Builtin/Types.hs @@ -809,7 +809,7 @@ bit odd: Zero-tuples have used up the logical name. So we use 'Solo' and 'Solo#' for one-tuples. So in ghc-prim:GHC.Tuple we see the declarations: data () = () - data Solo a = Solo a + data Solo a = MkSolo a data (a,b) = (a,b) There is no way to write a boxed one-tuple in Haskell using tuple syntax. @@ -832,7 +832,7 @@ Note [Don't flatten tuples from HsSyn] in GHC.Core.Make. -- Wrinkle: Make boxed one-tuple names have known keys ----- -We make boxed one-tuple names have known keys so that `data Solo a = Solo a`, +We make boxed one-tuple names have known keys so that `data Solo a = MkSolo a`, defined in GHC.Tuple, will be used when one-tuples are spliced in through Template Haskell. This program (from #18097) crucially relies on this: @@ -943,20 +943,21 @@ isPunOcc_maybe _ _ = Nothing mkTupleOcc :: NameSpace -> Boxity -> Arity -> OccName -- No need to cache these, the caching is done in mk_tuple -mkTupleOcc ns Boxed ar = mkOccName ns (mkBoxedTupleStr ar) +mkTupleOcc ns Boxed ar = mkOccName ns (mkBoxedTupleStr ns ar) mkTupleOcc ns Unboxed ar = mkOccName ns (mkUnboxedTupleStr ar) mkCTupleOcc :: NameSpace -> Arity -> OccName mkCTupleOcc ns ar = mkOccName ns (mkConstraintTupleStr ar) -mkTupleStr :: Boxity -> Arity -> String +mkTupleStr :: Boxity -> NameSpace -> Arity -> String mkTupleStr Boxed = mkBoxedTupleStr -mkTupleStr Unboxed = mkUnboxedTupleStr +mkTupleStr Unboxed = const mkUnboxedTupleStr -mkBoxedTupleStr :: Arity -> String -mkBoxedTupleStr 0 = "()" -mkBoxedTupleStr 1 = "Solo" -- See Note [One-tuples] -mkBoxedTupleStr ar = '(' : commas ar ++ ")" +mkBoxedTupleStr :: NameSpace -> Arity -> String +mkBoxedTupleStr _ 0 = "()" +mkBoxedTupleStr ns 1 | isDataConNameSpace ns = "MkSolo" -- See Note [One-tuples] +mkBoxedTupleStr _ 1 = "Solo" -- See Note [One-tuples] +mkBoxedTupleStr _ ar = '(' : commas ar ++ ")" mkUnboxedTupleStr :: Arity -> String mkUnboxedTupleStr 0 = "(##)" @@ -1117,7 +1118,7 @@ mk_tuple Boxed arity = (tycon, tuple_con) tuple_con = pcDataCon dc_name dc_tvs dc_arg_tys tycon boxity = Boxed - modu = gHC_TUPLE + modu = gHC_TUPLE_PRIM tc_name = mkWiredInName modu (mkTupleOcc tcName boxity arity) tc_uniq (ATyCon tycon) BuiltInSyntax dc_name = mkWiredInName modu (mkTupleOcc dataName boxity arity) dc_uniq diff --git a/compiler/GHC/Core/Opt/SpecConstr.hs b/compiler/GHC/Core/Opt/SpecConstr.hs index 05c7b00116..9119671f95 100644 --- a/compiler/GHC/Core/Opt/SpecConstr.hs +++ b/compiler/GHC/Core/Opt/SpecConstr.hs @@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-} +#if __GLASGOW_HASKELL__ < 905 +{-# LANGUAGE PatternSynonyms #-} +#endif {- ToDo [Oct 2013] ~~~~~~~~~~~~~~~ @@ -978,9 +981,13 @@ scSubstId env v = lookupIdSubst (sc_subst env) v -- Solo is only defined in base starting from ghc-9.2 #if !(MIN_VERSION_base(4, 16, 0)) - data Solo a = Solo a +#endif +-- The Solo constructor was renamed to MkSolo in ghc 9.5 +#if __GLASGOW_HASKELL__ < 905 +pattern MkSolo :: a -> Solo a +pattern MkSolo a = Solo a #endif -- The !subst ensures that we force the selection `(sc_subst env)`, which avoids @@ -994,7 +1001,7 @@ data Solo a = Solo a scSubstTy :: ScEnv -> InType -> Solo OutType scSubstTy env ty = let !subst = sc_subst env - in Solo (substTyUnchecked subst ty) + in MkSolo (substTyUnchecked subst ty) scSubstCo :: ScEnv -> Coercion -> Coercion scSubstCo env co = substCo (sc_subst env) co @@ -1446,7 +1453,7 @@ scExpr' env (Var v) = case scSubstId env v of e' -> scExpr (zapScSubst env) e' scExpr' env (Type t) = - let !(Solo ty') = scSubstTy env t + let !(MkSolo ty') = scSubstTy env t in return (nullUsage, Type ty') scExpr' env (Coercion c) = return (nullUsage, Coercion (scSubstCo env c)) scExpr' _ e@(Lit {}) = return (nullUsage, e) @@ -1490,7 +1497,7 @@ scExpr' env (Case scrut b ty alts) -- The combined usage of the scrutinee is given -- by scrut_occ, which is passed to setScrutOcc, which -- in turn treats a bare-variable scrutinee specially - ; let !(Solo ty') = scSubstTy env ty + ; let !(MkSolo ty') = scSubstTy env ty ; return (foldr combineUsage scrut_usg' alt_usgs, Case scrut' b' ty' alts') } diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index 5c40d351ec..b24531f790 100644 --- a/compiler/GHC/Hs/Expr.hs +++ b/compiler/GHC/Hs/Expr.hs @@ -549,7 +549,7 @@ ppr_expr (ExplicitTuple _ exprs boxity) -- `Solo x`, not `(x)` | [Present _ expr] <- exprs , Boxed <- boxity - = hsep [text (mkTupleStr Boxed 1), ppr expr] + = hsep [text (mkTupleStr Boxed dataName 1), ppr expr] | otherwise = tupleParens (boxityTupleSort boxity) (fcat (ppr_tup_args exprs)) where diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs index 3d251103ce..39a788aab5 100644 --- a/compiler/GHC/Hs/Pat.hs +++ b/compiler/GHC/Hs/Pat.hs @@ -81,7 +81,7 @@ import GHC.Core.Type import GHC.Types.SrcLoc import GHC.Data.Bag -- collect ev vars from pats import GHC.Data.Maybe -import GHC.Types.Name (Name) +import GHC.Types.Name (Name, dataName) import GHC.Driver.Session import qualified GHC.LanguageExtensions as LangExt import Data.Data @@ -353,7 +353,7 @@ pprPat (TuplePat _ pats bx) -- `Solo x`, not `(x)` | [pat] <- pats , Boxed <- bx - = hcat [text (mkTupleStr Boxed 1), pprParendLPat appPrec pat] + = hcat [text (mkTupleStr Boxed dataName 1), pprParendLPat appPrec pat] | otherwise = tupleParens (boxityTupleSort bx) (pprWithCommas ppr pats) pprPat (SumPat _ pat alt arity) = sumParens (pprAlternative ppr pat alt arity) diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index 770a91b35a..5e614ff79d 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -102,7 +102,7 @@ import GHC.Parser.Annotation import GHC.Types.Fixity ( LexicalFixity(..) ) import GHC.Types.Id ( Id ) import GHC.Types.SourceText -import GHC.Types.Name( Name, NamedThing(getName) ) +import GHC.Types.Name( Name, NamedThing(getName), tcName ) import GHC.Types.Name.Reader ( RdrName ) import GHC.Types.Var ( VarBndr ) import GHC.Core.TyCo.Rep ( Type(..) ) @@ -1145,7 +1145,7 @@ ppr_mono_ty (HsTupleTy _ con tys) -- `Solo x`, not `(x)` | [ty] <- tys , BoxedTuple <- std_con - = sep [text (mkTupleStr Boxed 1), ppr_mono_lty ty] + = sep [text (mkTupleStr Boxed tcName 1), ppr_mono_lty ty] | otherwise = tupleParens std_con (pprWithCommas ppr tys) where std_con = case con of @@ -1170,7 +1170,7 @@ ppr_mono_ty (HsExplicitTupleTy _ tys) -- Special-case unary boxed tuples so that they are pretty-printed as -- `'Solo x`, not `'(x)` | [ty] <- tys - = quote $ sep [text (mkTupleStr Boxed 1), ppr_mono_lty ty] + = quote $ sep [text (mkTupleStr Boxed tcName 1), ppr_mono_lty ty] | otherwise = quote $ parens (maybeAddSpace tys $ interpp'SP tys) ppr_mono_ty (HsTyLit _ t) = ppr t diff --git a/compiler/GHC/Types/Name/Cache.hs b/compiler/GHC/Types/Name/Cache.hs index 66fad6dbd8..6e18c77b32 100644 --- a/compiler/GHC/Types/Name/Cache.hs +++ b/compiler/GHC/Types/Name/Cache.hs @@ -102,7 +102,7 @@ takeUniqFromNameCache (NameCache c _) = uniqFromMask c lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name lookupOrigNameCache nc mod occ - | mod == gHC_TYPES || mod == gHC_PRIM || mod == gHC_TUPLE + | mod == gHC_TYPES || mod == gHC_PRIM || mod == gHC_TUPLE_PRIM , Just name <- isBuiltInOcc_maybe occ = -- See Note [Known-key names], 3(c) in GHC.Builtin.Names -- Special case for tuples; there are too many diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index d7cf0cc55a..4a0a0d0651 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -57,7 +57,7 @@ Executable ghc -- NB: this is never built by the bootstrapping GHC+libraries Build-depends: deepseq == 1.4.*, - ghc-prim >= 0.5.0 && < 0.10, + ghc-prim >= 0.5.0 && < 0.11, ghci == @ProjectVersionMunged@, haskeline == 0.8.*, exceptions == 0.10.*, diff --git a/libraries/base/Control/Monad/Fix.hs b/libraries/base/Control/Monad/Fix.hs index 9a55e926b8..a42becf778 100644 --- a/libraries/base/Control/Monad/Fix.hs +++ b/libraries/base/Control/Monad/Fix.hs @@ -67,7 +67,7 @@ class (Monad m) => MonadFix m where -- | @since 4.15 instance MonadFix Solo where mfix f = let a = f (unSolo a) in a - where unSolo (Solo x) = x + where unSolo (MkSolo x) = x -- | @since 2.01 instance MonadFix Maybe where diff --git a/libraries/base/Control/Monad/Zip.hs b/libraries/base/Control/Monad/Zip.hs index 01b6bfa44e..9e9cbcb731 100644 --- a/libraries/base/Control/Monad/Zip.hs +++ b/libraries/base/Control/Monad/Zip.hs @@ -75,7 +75,7 @@ instance MonadZip Identity where -- | @since 4.15.0.0 instance MonadZip Solo where mzipWith = liftM2 - munzip (Solo (a, b)) = (Solo a, Solo b) + munzip (MkSolo (a, b)) = (MkSolo a, MkSolo b) -- | @since 4.8.0.0 instance MonadZip Dual where diff --git a/libraries/base/Data/Functor/Classes.hs b/libraries/base/Data/Functor/Classes.hs index 92f3f89e1e..e54e1ba83a 100644 --- a/libraries/base/Data/Functor/Classes.hs +++ b/libraries/base/Data/Functor/Classes.hs @@ -577,7 +577,7 @@ instance Show2 (,) where -- | @since 4.15 instance Eq1 Solo where - liftEq eq (Solo a) (Solo b) = a `eq` b + liftEq eq (MkSolo a) (MkSolo b) = a `eq` b -- | @since 4.9.0.0 instance (Eq a) => Eq1 ((,) a) where @@ -585,7 +585,7 @@ instance (Eq a) => Eq1 ((,) a) where -- | @since 4.15 instance Ord1 Solo where - liftCompare cmp (Solo a) (Solo b) = cmp a b + liftCompare cmp (MkSolo a) (MkSolo b) = cmp a b -- | @since 4.9.0.0 instance (Ord a) => Ord1 ((,) a) where @@ -593,7 +593,7 @@ instance (Ord a) => Ord1 ((,) a) where -- | @since 4.15 instance Read1 Solo where - liftReadPrec rp _ = readData (readUnaryWith rp "Solo" Solo) + liftReadPrec rp _ = readData (readUnaryWith rp "MkSolo" MkSolo) liftReadListPrec = liftReadListPrecDefault liftReadList = liftReadListDefault @@ -607,7 +607,7 @@ instance (Read a) => Read1 ((,) a) where -- | @since 4.15 instance Show1 Solo where - liftShowsPrec sp _ d (Solo x) = showsUnaryWith sp "Solo" d x + liftShowsPrec sp _ d (MkSolo x) = showsUnaryWith sp "MkSolo" d x -- | @since 4.9.0.0 instance (Show a) => Show1 ((,) a) where 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 diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index 6965827c0a..851c98792d 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -86,7 +86,7 @@ Library build-depends: rts == 1.0.*, - ghc-prim >= 0.5.1.0 && < 0.10, + ghc-prim >= 0.5.1.0 && < 0.11, ghc-bignum >= 1.0 && < 2.0 exposed-modules: diff --git a/libraries/deepseq b/libraries/deepseq -Subproject 38ab699cd5e08a85fdc9ac27f1612ce130e98a5 +Subproject 28f4d5b00448239581ead0de9140ff4a6847c80 diff --git a/libraries/ghc-bignum/ghc-bignum.cabal b/libraries/ghc-bignum/ghc-bignum.cabal index 58d7a527de..002e77abeb 100644 --- a/libraries/ghc-bignum/ghc-bignum.cabal +++ b/libraries/ghc-bignum/ghc-bignum.cabal @@ -77,7 +77,7 @@ library ForeignFunctionInterface build-depends: - ghc-prim >= 0.5.1.0 && < 0.10 + ghc-prim >= 0.5.1.0 && < 0.11 hs-source-dirs: src/ include-dirs: include/ diff --git a/libraries/ghc-compact/ghc-compact.cabal b/libraries/ghc-compact/ghc-compact.cabal index 12a5e509b4..bdb48de494 100644 --- a/libraries/ghc-compact/ghc-compact.cabal +++ b/libraries/ghc-compact/ghc-compact.cabal @@ -39,7 +39,7 @@ library UnboxedTuples CPP - build-depends: ghc-prim >= 0.5.3 && < 0.10, + build-depends: ghc-prim >= 0.5.3 && < 0.11, base >= 4.9.0 && < 4.18, bytestring >= 0.10.6.0 && <0.12 ghc-options: -Wall diff --git a/libraries/ghc-heap/ghc-heap.cabal.in b/libraries/ghc-heap/ghc-heap.cabal.in index 2c6e6794c1..d1db0e250c 100644 --- a/libraries/ghc-heap/ghc-heap.cabal.in +++ b/libraries/ghc-heap/ghc-heap.cabal.in @@ -23,7 +23,7 @@ library default-language: Haskell2010 build-depends: base >= 4.9.0 && < 5.0 - , ghc-prim > 0.2 && < 0.10 + , ghc-prim > 0.2 && < 0.11 , rts == 1.0.* , containers >= 0.6.2.1 && < 0.7 diff --git a/libraries/ghc-prim/GHC/Tuple.hs b/libraries/ghc-prim/GHC/Tuple.hs index 78904f411e..c884108afa 100644 --- a/libraries/ghc-prim/GHC/Tuple.hs +++ b/libraries/ghc-prim/GHC/Tuple.hs @@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE NoImplicitPrelude, DeriveGeneric #-} +{-# LANGUAGE NoImplicitPrelude, PatternSynonyms #-} ----------------------------------------------------------------------------- -- | -- Module : GHC.Tuple @@ -16,219 +16,19 @@ -- ----------------------------------------------------------------------------- -module GHC.Tuple where +module GHC.Tuple ( + module GHC.Tuple.Prim, + Solo (Solo, MkSolo), +) where import GHC.CString () -- Make sure we do it first, so that the -- implicit Typeable stuff can see GHC.Types.TyCon -- and unpackCString# etc +import GHC.Tuple.Prim default () -- Double and Integer aren't available yet --- | The unit datatype @()@ has one non-undefined member, the nullary --- constructor @()@. -data () = () - --- The desugarer uses 1-tuples, --- but "()" is already used up for 0-tuples --- See Note [One-tuples] in GHC.Builtin.Types - --- | @Solo@ is the canonical lifted 1-tuple, just like '(,)' is the canonical --- lifted 2-tuple (pair) and '(,,)' is the canonical lifted 3-tuple (triple). --- --- The most important feature of @Solo@ is that it is possible to force its --- "outside" (usually by pattern matching) without forcing its "inside", --- because it is defined as a datatype rather than a newtype. One situation --- where this can be useful is when writing a function to extract a value from --- a data structure. Suppose you write an implementation of arrays and offer --- only this function to index into them: --- --- @ --- index :: Array a -> Int -> a --- @ --- --- Now imagine that someone wants to extract a value from an array and store it --- in a lazy-valued finite map/dictionary: --- --- @ --- insert "hello" (arr `index` 12) m --- @ --- --- This can actually lead to a space leak. The value is not actually extracted --- from the array until that value (now buried in a map) is forced. That means --- the entire array may be kept live by just that value! Often, the solution --- is to use a strict map, or to force the value before storing it, but for --- some purposes that's undesirable. --- --- One common solution is to include an indexing function that can produce its --- result in an arbitrary @Applicative@ context: --- --- @ --- indexA :: Applicative f => Array a -> Int -> f a --- @ --- --- When using @indexA@ in a /pure/ context, @Solo@ serves as a handy --- @Applicative@ functor to hold the result. You could write a non-leaky --- version of the above example thus: --- --- @ --- case arr `indexA` 12 of --- Solo a -> insert "hello" a m --- @ --- --- While such simple extraction functions are the most common uses for --- unary tuples, they can also be useful for fine-grained control of --- strict-spined data structure traversals, and for unifying the --- implementations of lazy and strict mapping functions. -data Solo a = Solo a - -getSolo :: Solo a -> a --- getSolo is a standalone function, rather than a record field of Solo, --- because Solo is a wired-in TyCon, and a wired-in TyCon that has --- record fields is a bit more inconvenient than if it doesn't. --- (No other wired-in TyCon has record fields.) So it seems easier --- to have getSolo as its own separate function (#20562) -getSolo (Solo a) = a - -data (a,b) = (a,b) -data (a,b,c) = (a,b,c) -data (a,b,c,d) = (a,b,c,d) -data (a,b,c,d,e) = (a,b,c,d,e) -data (a,b,c,d,e,f) = (a,b,c,d,e,f) -data (a,b,c,d,e,f,g) = (a,b,c,d,e,f,g) -data (a,b,c,d,e,f,g,h) = (a,b,c,d,e,f,g,h) -data (a,b,c,d,e,f,g,h,i) = (a,b,c,d,e,f,g,h,i) -data (a,b,c,d,e,f,g,h,i,j) = (a,b,c,d,e,f,g,h,i,j) -data (a,b,c,d,e,f,g,h,i,j,k) = (a,b,c,d,e,f,g,h,i,j,k) -data (a,b,c,d,e,f,g,h,i,j,k,l) = (a,b,c,d,e,f,g,h,i,j,k,l) -data (a,b,c,d,e,f,g,h,i,j,k,l,m) = (a,b,c,d,e,f,g,h,i,j,k,l,m) -data (a,b,c,d,e,f,g,h,i,j,k,l,m,n) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n) -data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) -data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) = (a,b,c,d,e,f,g,h,i,j,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,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2) -data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, - r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,l2) - = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, - r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,l2) +{-# DEPRECATED Solo "The Solo constructor has been renamed to MkSolo to avoid punning." #-} +pattern Solo :: a -> Solo a +pattern Solo x = MkSolo x +{-# COMPLETE Solo #-} diff --git a/libraries/ghc-prim/GHC/Tuple/Prim.hs b/libraries/ghc-prim/GHC/Tuple/Prim.hs new file mode 100644 index 0000000000..96b1c0c9a6 --- /dev/null +++ b/libraries/ghc-prim/GHC/Tuple/Prim.hs @@ -0,0 +1,232 @@ +{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE NoImplicitPrelude, DeriveGeneric #-} +----------------------------------------------------------------------------- +-- | +-- Module : GHC.Tuple.Prim +-- Copyright : (c) The University of Glasgow 2001 +-- License : BSD-style (see the file libraries/ghc-prim/LICENSE) +-- +-- Maintainer : libraries@haskell.org +-- Stability : experimental +-- Portability : non-portable (GHC extensions) +-- +-- The tuple data types +-- +----------------------------------------------------------------------------- + +module GHC.Tuple.Prim where + +import GHC.CString () -- Make sure we do it first, so that the + -- implicit Typeable stuff can see GHC.Types.TyCon + -- and unpackCString# etc + +default () -- Double and Integer aren't available yet + +-- | The unit datatype @()@ has one non-undefined member, the nullary +-- constructor @()@. +data () = () + +-- The desugarer uses 1-tuples, +-- but "()" is already used up for 0-tuples +-- See Note [One-tuples] in GHC.Builtin.Types + +-- | @Solo@ is the canonical lifted 1-tuple, just like '(,)' is the canonical +-- lifted 2-tuple (pair) and '(,,)' is the canonical lifted 3-tuple (triple). +-- +-- The most important feature of @Solo@ is that it is possible to force its +-- "outside" (usually by pattern matching) without forcing its "inside", +-- because it is defined as a datatype rather than a newtype. One situation +-- where this can be useful is when writing a function to extract a value from +-- a data structure. Suppose you write an implementation of arrays and offer +-- only this function to index into them: +-- +-- @ +-- index :: Array a -> Int -> a +-- @ +-- +-- Now imagine that someone wants to extract a value from an array and store it +-- in a lazy-valued finite map/dictionary: +-- +-- @ +-- insert "hello" (arr `index` 12) m +-- @ +-- +-- This can actually lead to a space leak. The value is not actually extracted +-- from the array until that value (now buried in a map) is forced. That means +-- the entire array may be kept live by just that value! Often, the solution +-- is to use a strict map, or to force the value before storing it, but for +-- some purposes that's undesirable. +-- +-- One common solution is to include an indexing function that can produce its +-- result in an arbitrary @Applicative@ context: +-- +-- @ +-- indexA :: Applicative f => Array a -> Int -> f a +-- @ +-- +-- When using @indexA@ in a /pure/ context, @Solo@ serves as a handy +-- @Applicative@ functor to hold the result. You could write a non-leaky +-- version of the above example thus: +-- +-- @ +-- case arr `indexA` 12 of +-- Solo a -> insert "hello" a m +-- @ +-- +-- While such simple extraction functions are the most common uses for +-- unary tuples, they can also be useful for fine-grained control of +-- strict-spined data structure traversals, and for unifying the +-- implementations of lazy and strict mapping functions. +data Solo a = MkSolo a + +getSolo :: Solo a -> a +-- getSolo is a standalone function, rather than a record field of Solo, +-- because Solo is a wired-in TyCon, and a wired-in TyCon that has +-- record fields is a bit more inconvenient than if it doesn't. +-- (No other wired-in TyCon has record fields.) So it seems easier +-- to have getSolo as its own separate function (#20562) +getSolo (MkSolo a) = a + +data (a,b) = (a,b) +data (a,b,c) = (a,b,c) +data (a,b,c,d) = (a,b,c,d) +data (a,b,c,d,e) = (a,b,c,d,e) +data (a,b,c,d,e,f) = (a,b,c,d,e,f) +data (a,b,c,d,e,f,g) = (a,b,c,d,e,f,g) +data (a,b,c,d,e,f,g,h) = (a,b,c,d,e,f,g,h) +data (a,b,c,d,e,f,g,h,i) = (a,b,c,d,e,f,g,h,i) +data (a,b,c,d,e,f,g,h,i,j) = (a,b,c,d,e,f,g,h,i,j) +data (a,b,c,d,e,f,g,h,i,j,k) = (a,b,c,d,e,f,g,h,i,j,k) +data (a,b,c,d,e,f,g,h,i,j,k,l) = (a,b,c,d,e,f,g,h,i,j,k,l) +data (a,b,c,d,e,f,g,h,i,j,k,l,m) = (a,b,c,d,e,f,g,h,i,j,k,l,m) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w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2) + = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, + r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, + r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2) + = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, + r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2) +data (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, + r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,l2) + = (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1, + r1,s1,t1,u1,v1,w1,x1,y1,z1,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,l2) diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal index 4755566663..db1fc1453e 100644 --- a/libraries/ghc-prim/ghc-prim.cabal +++ b/libraries/ghc-prim/ghc-prim.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: ghc-prim -version: 0.9.0 +version: 0.10.0 -- NOTE: Don't forget to update ./changelog.md license: BSD-3-Clause license-file: LICENSE @@ -56,6 +56,7 @@ Library GHC.Prim.PtrEq GHC.PrimopWrappers GHC.Tuple + GHC.Tuple.Prim GHC.Types virtual-modules: diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in index 643680e0bf..16c6ffafe3 100644 --- a/libraries/ghci/ghci.cabal.in +++ b/libraries/ghci/ghci.cabal.in @@ -71,7 +71,7 @@ library rts, array == 0.5.*, base >= 4.8 && < 4.18, - ghc-prim >= 0.5.0 && < 0.10, + ghc-prim >= 0.5.0 && < 0.11, binary == 0.8.*, bytestring >= 0.10 && < 0.12, containers >= 0.5 && < 0.7, diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index c719541074..2fb37e742b 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -1414,7 +1414,7 @@ dataToQa mkCon mkLit appCon antiQ t = con@('(':_) -> Name (mkOccName con) (NameG DataName (mkPkgName "ghc-prim") - (mkModName "GHC.Tuple")) + (mkModName "GHC.Tuple.Prim")) -- Tricky case: see Note [Data for non-algebraic types] fun@(x:_) | startsVarSym x || startsVarId x @@ -1886,10 +1886,13 @@ mk_tup_name n space boxed withParens thing | boxed = "(" ++ thing ++ ")" | otherwise = "(#" ++ thing ++ "#)" - tup_occ | n == 1 = if boxed then "Solo" else "Solo#" + tup_occ | n == 1 = if boxed then solo else "Solo#" | otherwise = withParens (replicate n_commas ',') n_commas = n - 1 - tup_mod = mkModName "GHC.Tuple" + tup_mod = mkModName "GHC.Tuple.Prim" + solo + | space == DataName = "MkSolo" + | otherwise = "Solo" -- Unboxed sum data and type constructors -- | Unboxed sum data constructor diff --git a/libraries/text b/libraries/text -Subproject fdb06ff327519f3c0fc6cc9997b7cb7fe8ab817 +Subproject 5558730e76923f2d5d7fbc8783ab1ecc25bfe15 @@ -1,4 +1,4 @@ -# Despite the name "package", this file contains the master list of +# Despite the name "packages", this file contains the master list of # the *repositories* that make up GHC. It is parsed by # * boot # * rules/foreachLibrary.mk diff --git a/rts/Prelude.h b/rts/Prelude.h index 2a935f9f90..3db5546ad0 100644 --- a/rts/Prelude.h +++ b/rts/Prelude.h @@ -29,7 +29,7 @@ PRELUDE_CLOSURE(ghczmprim_GHCziPrimziException_raiseDivZZero_closure); * modules these names are defined in. */ -PRELUDE_CLOSURE(ghczmprim_GHCziTuple_Z0T_closure); +PRELUDE_CLOSURE(ghczmprim_GHCziTupleziPrim_Z0T_closure); PRELUDE_CLOSURE(ghczmprim_GHCziTypes_True_closure); PRELUDE_CLOSURE(ghczmprim_GHCziTypes_False_closure); PRELUDE_CLOSURE(base_GHCziPack_unpackCString_closure); @@ -88,7 +88,7 @@ PRELUDE_INFO(base_GHCziWord_W32zh_con_info); PRELUDE_INFO(base_GHCziWord_W64zh_con_info); PRELUDE_INFO(base_GHCziStable_StablePtr_con_info); -#define Unit_closure DLL_IMPORT_DATA_REF(ghczmprim_GHCziTuple_Z0T_closure) +#define Unit_closure DLL_IMPORT_DATA_REF(ghczmprim_GHCziTupleziPrim_Z0T_closure) #define True_closure DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_True_closure) #define False_closure DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_False_closure) #define unpackCString_closure DLL_IMPORT_DATA_REF(base_GHCziPack_unpackCString_closure) diff --git a/rts/package.conf.in b/rts/package.conf.in index 248b6b9c57..42359f301a 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -85,7 +85,7 @@ ld-options: "-Wl,-u,_base_GHCziTopHandler_runIO_closure" , "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure" - , "-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure" + , "-Wl,-u,_ghczmprim_GHCziTupleziPrim_Z0T_closure" , "-Wl,-u,_ghczmprim_GHCziTypes_True_closure" , "-Wl,-u,_ghczmprim_GHCziTypes_False_closure" , "-Wl,-u,_base_GHCziPack_unpackCString_closure" @@ -198,7 +198,7 @@ ld-options: "-Wl,-u,base_GHCziTopHandler_runIO_closure" , "-Wl,-u,base_GHCziTopHandler_runNonIO_closure" - , "-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure" + , "-Wl,-u,ghczmprim_GHCziTupleziPrim_Z0T_closure" , "-Wl,-u,ghczmprim_GHCziTypes_True_closure" , "-Wl,-u,ghczmprim_GHCziTypes_False_closure" , "-Wl,-u,base_GHCziPack_unpackCString_closure" diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index a1ef38808b..68648f0ba6 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -258,7 +258,7 @@ library ld-options: "-Wl,-u,_base_GHCziTopHandler_runIO_closure" "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure" - "-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure" + "-Wl,-u,_ghczmprim_GHCziTupleziPrim_Z0T_closure" "-Wl,-u,_ghczmprim_GHCziTypes_True_closure" "-Wl,-u,_ghczmprim_GHCziTypes_False_closure" "-Wl,-u,_base_GHCziPack_unpackCString_closure" @@ -341,7 +341,7 @@ library ld-options: "-Wl,-u,base_GHCziTopHandler_runIO_closure" "-Wl,-u,base_GHCziTopHandler_runNonIO_closure" - "-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure" + "-Wl,-u,ghczmprim_GHCziTupleziPrim_Z0T_closure" "-Wl,-u,ghczmprim_GHCziTypes_True_closure" "-Wl,-u,ghczmprim_GHCziTypes_False_closure" "-Wl,-u,base_GHCziPack_unpackCString_closure" diff --git a/testsuite/tests/backpack/should_compile/bkp16.stderr b/testsuite/tests/backpack/should_compile/bkp16.stderr index 06d2865c24..be66498482 100644 --- a/testsuite/tests/backpack/should_compile/bkp16.stderr +++ b/testsuite/tests/backpack/should_compile/bkp16.stderr @@ -4,6 +4,6 @@ Instantiating q [1 of 1] Including p[Int=base-4.17.0.0:GHC.Exts] Instantiating p[Int=base-4.17.0.0:GHC.Exts] - [1 of 1] Including ghc-prim-0.9.0 + [1 of 1] Including ghc-prim-0.10.0 [1 of 1] Compiling Int[sig] ( p/Int.hsig, bkp16.out/p/p-97PZnzqiJmd2hTwUNGdjod/Int.o ) [1 of 1] Instantiating p diff --git a/testsuite/tests/ghci/scripts/T4127.stdout b/testsuite/tests/ghci/scripts/T4127.stdout index 509bb88835..3d2fad2539 100644 --- a/testsuite/tests/ghci/scripts/T4127.stdout +++ b/testsuite/tests/ghci/scripts/T4127.stdout @@ -1 +1 @@ -[InstanceD Nothing [] (AppT (ConT GHC.Base.Monad) (AppT (ConT GHC.Tuple.(,)) (VarT a_0))) [ValD (VarP GHC.Base.>>=) (NormalB (VarE GHC.Err.undefined)) []]]
\ No newline at end of file +[InstanceD Nothing [] (AppT (ConT GHC.Base.Monad) (AppT (ConT GHC.Tuple.Prim.(,)) (VarT a_0))) [ValD (VarP GHC.Base.>>=) (NormalB (VarE GHC.Err.undefined)) []]] diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index 91a1fbb881..0d4047425e 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -24,7 +24,7 @@ type family E a where -- Defined at T4175.hs:25:1 type () :: * data () = () - -- Defined in ‘GHC.Tuple’ + -- Defined in ‘GHC.Tuple.Prim’ instance [safe] C () -- Defined at T4175.hs:22:10 instance Monoid () -- Defined in ‘GHC.Base’ instance Semigroup () -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout index 1a390d152f..d819079041 100644 --- a/testsuite/tests/ghci/scripts/T7627.stdout +++ b/testsuite/tests/ghci/scripts/T7627.stdout @@ -1,6 +1,6 @@ type () :: * data () = () - -- Defined in ‘GHC.Tuple’ + -- Defined in ‘GHC.Tuple.Prim’ instance Monoid () -- Defined in ‘GHC.Base’ instance Semigroup () -- Defined in ‘GHC.Base’ instance Bounded () -- Defined in ‘GHC.Enum’ @@ -18,7 +18,7 @@ data (##) = (##) (# #) :: (# #) type (,) :: * -> * -> * data (,) a b = (,) a b - -- Defined in ‘GHC.Tuple’ + -- Defined in ‘GHC.Tuple.Prim’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ instance (Monoid a, Monoid b) => Monoid (a, b) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/ghci011.stdout b/testsuite/tests/ghci/scripts/ghci011.stdout index edb6158456..32190117fd 100644 --- a/testsuite/tests/ghci/scripts/ghci011.stdout +++ b/testsuite/tests/ghci/scripts/ghci011.stdout @@ -15,7 +15,7 @@ instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’ type () :: * data () = () - -- Defined in ‘GHC.Tuple’ + -- Defined in ‘GHC.Tuple.Prim’ instance Monoid () -- Defined in ‘GHC.Base’ instance Semigroup () -- Defined in ‘GHC.Base’ instance Read () -- Defined in ‘GHC.Read’ @@ -26,7 +26,7 @@ instance Show () -- Defined in ‘GHC.Show’ instance Eq () -- Defined in ‘GHC.Classes’ type (,) :: * -> * -> * data (,) a b = (,) a b - -- Defined in ‘GHC.Tuple’ + -- Defined in ‘GHC.Tuple.Prim’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ instance (Monoid a, Monoid b) => Monoid (a, b) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/should_run/T21052.stdout b/testsuite/tests/ghci/should_run/T21052.stdout index 7de5eaf6ca..3822a96b6e 100644 --- a/testsuite/tests/ghci/should_run/T21052.stdout +++ b/testsuite/tests/ghci/should_run/T21052.stdout @@ -6,7 +6,7 @@ BCO_toplevel :: GHC.Types.IO [()] let { sat :: [()] [LclId] = - :! [GHC.Tuple.() GHC.Types.[]]; + :! [GHC.Tuple.Prim.() GHC.Types.[]]; } in GHC.Base.returnIO sat; diff --git a/testsuite/tests/module/T20562.hs b/testsuite/tests/module/T20562.hs index 352be5e9e2..e046947f33 100644 --- a/testsuite/tests/module/T20562.hs +++ b/testsuite/tests/module/T20562.hs @@ -1,7 +1,7 @@ {-# LANGUAGE PatternSynonyms #-} module Main (main) where -import GHC.Tuple +import GHC.Tuple (Solo (MkSolo), getSolo) type OneTuple = Solo @@ -9,7 +9,7 @@ only :: OneTuple a -> a only = getSolo pattern OneTuple :: a -> Solo a -pattern OneTuple a = Solo a +pattern OneTuple a = MkSolo a main :: IO () main = print (only (OneTuple 'x')) diff --git a/testsuite/tests/roles/should_compile/T8958.stderr b/testsuite/tests/roles/should_compile/T8958.stderr index b06d0df7f8..469188e621 100644 --- a/testsuite/tests/roles/should_compile/T8958.stderr +++ b/testsuite/tests/roles/should_compile/T8958.stderr @@ -49,7 +49,7 @@ $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep $krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* $krep $krep [InlPrag=[~]] = GHC.Types.KindRepTyConApp - GHC.Tuple.$tc(,) + GHC.Tuple.Prim.$tc(,) ((:) @GHC.Types.KindRep $krep ((:) @GHC.Types.KindRep $krep [] @GHC.Types.KindRep)) $krep [InlPrag=[~]] diff --git a/testsuite/tests/simplCore/should_compile/T3772.stdout b/testsuite/tests/simplCore/should_compile/T3772.stdout index dde2503f31..4a67fd8413 100644 --- a/testsuite/tests/simplCore/should_compile/T3772.stdout +++ b/testsuite/tests/simplCore/should_compile/T3772.stdout @@ -72,12 +72,12 @@ foo [InlPrag=[final]] :: Int -> () Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (n [Occ=Once1!] :: Int) -> case n of { GHC.Types.I# ww [Occ=Once1] -> - case T3772.$wfoo ww of { (# #) -> GHC.Tuple.() } + case T3772.$wfoo ww of { (# #) -> GHC.Tuple.Prim.() } }}] foo = \ (n :: Int) -> case n of { GHC.Types.I# ww -> - case T3772.$wfoo ww of { (# #) -> GHC.Tuple.() } + case T3772.$wfoo ww of { (# #) -> GHC.Tuple.Prim.() } } diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr index 30efb85c29..345efa5a18 100644 --- a/testsuite/tests/simplCore/should_compile/T7360.stderr +++ b/testsuite/tests/simplCore/should_compile/T7360.stderr @@ -36,9 +36,9 @@ fun1 [InlPrag=[final]] :: Foo -> () WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (x [Occ=Once1] :: Foo) -> - case T7360.$wfun1 x of { (# #) -> GHC.Tuple.() }}] + case T7360.$wfun1 x of { (# #) -> GHC.Tuple.Prim.() }}] fun1 - = \ (x :: Foo) -> case T7360.$wfun1 x of { (# #) -> GHC.Tuple.() } + = \ (x :: Foo) -> case T7360.$wfun1 x of { (# #) -> GHC.Tuple.Prim.() } -- RHS size: {terms: 5, types: 1, coercions: 0, joins: 0/0} T7360.fun4 :: () @@ -46,7 +46,7 @@ T7360.fun4 :: () Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 10}] T7360.fun4 - = case T7360.$wfun1 T7360.Foo1 of { (# #) -> GHC.Tuple.() } + = case T7360.$wfun1 T7360.Foo1 of { (# #) -> GHC.Tuple.Prim.() } -- RHS size: {terms: 11, types: 7, coercions: 0, joins: 0/0} fun2 :: forall {a}. [a] -> ((), Int) diff --git a/testsuite/tests/th/T10734.stdout b/testsuite/tests/th/T10734.stdout index 4a8b39a43e..ae5bccbfb7 100644 --- a/testsuite/tests/th/T10734.stdout +++ b/testsuite/tests/th/T10734.stdout @@ -1,3 +1,3 @@ -do {let {}; GHC.Base.return GHC.Tuple.()} +do {let {}; GHC.Base.return GHC.Tuple.Prim.()} do {let {x_0 = 5}; GHC.Base.return x_0} do {let {x_0 = 5; y_1 = 3}; GHC.Base.return x_0} diff --git a/testsuite/tests/th/T12478_4.stderr b/testsuite/tests/th/T12478_4.stderr index 2cc0d1142d..f061f5706a 100644 --- a/testsuite/tests/th/T12478_4.stderr +++ b/testsuite/tests/th/T12478_4.stderr @@ -2,5 +2,5 @@ T12478_4.hs:7:7: error: • Illegal sum arity: 1 Sums must have an arity of at least 2 - When splicing a TH type: (# #) GHC.Tuple.() + When splicing a TH type: (# #) GHC.Tuple.Prim.() • In the untyped splice: $(unboxedSumT 1 `appT` conT ''()) diff --git a/testsuite/tests/th/T15843.stdout b/testsuite/tests/th/T15843.stdout index b7fede7e46..bd56e72b5f 100644 --- a/testsuite/tests/th/T15843.stdout +++ b/testsuite/tests/th/T15843.stdout @@ -2,8 +2,8 @@ TupE [Just (LitE (IntegerL 909)),Nothing] (909,) TupE [Nothing,Just (LitE (IntegerL 909))] (, 909) -ConE GHC.Tuple.(,) -GHC.Tuple.(,) +ConE GHC.Tuple.Prim.(,) +GHC.Tuple.Prim.(,) TupE [Just (LitE (IntegerL 909)),Just (LitE (IntegerL 606))] (909, 606) TupE [Nothing,Nothing,Just (LitE (IntegerL 909))] @@ -12,8 +12,8 @@ TupE [Just (LitE (IntegerL 909)),Nothing] (909,) TupE [Nothing,Just (LitE (IntegerL 909))] (, 909) -ConE GHC.Tuple.(,) -GHC.Tuple.(,) +ConE GHC.Tuple.Prim.(,) +GHC.Tuple.Prim.(,) TupE [Just (LitE (IntegerL 909)),Just (LitE (IntegerL 606))] (909, 606) TupE [Nothing,Nothing,Just (LitE (IntegerL 909))] diff --git a/testsuite/tests/th/T17380.stderr b/testsuite/tests/th/T17380.stderr index b9e1430ff7..d1f4684062 100644 --- a/testsuite/tests/th/T17380.stderr +++ b/testsuite/tests/th/T17380.stderr @@ -8,8 +8,8 @@ T17380.hs:9:7: error: [GHC-83865] T17380.hs:12:8: error: [GHC-83865] • Couldn't match expected type: Maybe String with actual type: Solo (Maybe String) - • In the expression: Solo Just "wat" - In an equation for ‘bar’: bar = (Solo Just "wat") + • In the expression: MkSolo Just "wat" + In an equation for ‘bar’: bar = (MkSolo Just "wat") T17380.hs:15:6: error: [GHC-83865] • Couldn't match expected type: Solo (Maybe String) @@ -20,8 +20,8 @@ T17380.hs:15:6: error: [GHC-83865] T17380.hs:18:7: error: [GHC-83865] • Couldn't match expected type: Maybe String with actual type: Solo (Maybe String) - • In the pattern: Solo(Just "wat") - In an equation for ‘quux’: quux (Solo(Just "wat")) = Just "frerf" + • In the pattern: MkSolo(Just "wat") + In an equation for ‘quux’: quux (MkSolo(Just "wat")) = Just "frerf" T17380.hs:21:8: error: [GHC-83865] • Couldn't match type: Maybe String diff --git a/testsuite/tests/th/T18097.hs b/testsuite/tests/th/T18097.hs index 2f905d9627..ebdc7f80c0 100644 --- a/testsuite/tests/th/T18097.hs +++ b/testsuite/tests/th/T18097.hs @@ -4,11 +4,11 @@ module T18097 where import Language.Haskell.TH import GHC.Tuple -f = case $( tupE [ [| "ok" |] ] ) of Solo x -> putStrLn x -g = case Solo "ok" of $( tupP [ [p| x |] ] ) -> putStrLn x +f = case $( tupE [ [| "ok" |] ] ) of MkSolo x -> putStrLn x +g = case MkSolo "ok" of $( tupP [ [p| x |] ] ) -> putStrLn x h :: $( tupleT 1 ) String -h = Solo "ok" +h = MkSolo "ok" i :: Solo String i = $( tupE [ [| "ok" |] ] ) diff --git a/testsuite/tests/th/T18612.stderr b/testsuite/tests/th/T18612.stderr index 25286ef671..0865ddc17b 100644 --- a/testsuite/tests/th/T18612.stderr +++ b/testsuite/tests/th/T18612.stderr @@ -8,6 +8,6 @@ T18612.hs:(10,7)-(11,75): Splicing type ======> Identity (Solo ()) -> Identity (Solo ()) T18612.hs:12:4-36: Splicing pattern - conP 'Identity [tupP [tupP []]] ======> Identity (Solo()) + conP 'Identity [tupP [tupP []]] ======> Identity (MkSolo()) T18612.hs:12:41-78: Splicing expression - conE 'Identity `appE` tupE [tupE []] ======> Identity (Solo ()) + conE 'Identity `appE` tupE [tupE []] ======> Identity (MkSolo ()) diff --git a/testsuite/tests/th/T20711.stdout b/testsuite/tests/th/T20711.stdout index f14e7b3479..922cf37e8f 100644 --- a/testsuite/tests/th/T20711.stdout +++ b/testsuite/tests/th/T20711.stdout @@ -1,2 +1,2 @@ -f_0 (-1) = GHC.Tuple.() -f_0 (-10) = GHC.Tuple.() +f_0 (-1) = GHC.Tuple.Prim.() +f_0 (-10) = GHC.Tuple.Prim.() diff --git a/testsuite/tests/th/T8761.stderr b/testsuite/tests/th/T8761.stderr index 03f5086423..0817e4b7a6 100644 --- a/testsuite/tests/th/T8761.stderr +++ b/testsuite/tests/th/T8761.stderr @@ -1,5 +1,5 @@ pattern Q1 x1_0 x2_1 x3_2 <- ((x1_0, x2_1), [x3_2], _, _) -pattern x1_0 `Q2` x2_1 = GHC.Tuple.Solo (x1_0, x2_1) +pattern x1_0 `Q2` x2_1 = GHC.Tuple.Prim.MkSolo (x1_0, x2_1) pattern Q3 {qx3, qy3, qz3} <- ((qx3, qy3), [qz3]) where Q3 qx3 qy3 qz3 = ((qx3, qy3), [qz3]) T8761.hs:(16,1)-(39,13): Splicing declarations @@ -28,7 +28,7 @@ T8761.hs:(16,1)-(39,13): Splicing declarations return pats ======> pattern Q1 x1 x2 x3 <- ((x1, x2), [x3], _, _) - pattern x1 `Q2` x2 = Solo(x1, x2) + pattern x1 `Q2` x2 = MkSolo(x1, x2) pattern Q3{qx3, qy3, qz3} <- ((qx3, qy3), [qz3]) where Q3 qx3 qy3 qz3 = ((qx3, qy3), [qz3]) T8761.hs:(42,1)-(46,29): Splicing declarations diff --git a/testsuite/tests/th/TH_tuple1.stdout b/testsuite/tests/th/TH_tuple1.stdout index c79b30cd21..b76f7e1fbf 100644 --- a/testsuite/tests/th/TH_tuple1.stdout +++ b/testsuite/tests/th/TH_tuple1.stdout @@ -1,10 +1,10 @@ -SigE (AppE (AppE (ConE GHC.Tuple.(,)) (LitE (IntegerL 1))) (LitE (IntegerL 2))) (AppT (AppT (ConT GHC.Tuple.(,)) (ConT GHC.Num.Integer.Integer)) (ConT GHC.Num.Integer.Integer)) -GHC.Tuple.(,) 1 2 :: GHC.Tuple.(,) GHC.Num.Integer.Integer - GHC.Num.Integer.Integer -SigE (AppE (ConE GHC.Tuple.Solo) (LitE (IntegerL 1))) (AppT (ConT GHC.Tuple.Solo) (ConT GHC.Num.Integer.Integer)) -GHC.Tuple.Solo 1 :: GHC.Tuple.Solo GHC.Num.Integer.Integer -SigE (AppE (AppE (ConE GHC.Tuple.(#,#)) (LitE (IntegerL 1))) (LitE (IntegerL 2))) (AppT (AppT (ConT GHC.Tuple.(#,#)) (ConT GHC.Num.Integer.Integer)) (ConT GHC.Num.Integer.Integer)) -GHC.Tuple.(#,#) 1 2 :: GHC.Tuple.(#,#) GHC.Num.Integer.Integer - GHC.Num.Integer.Integer -SigE (AppE (ConE GHC.Tuple.Solo#) (LitE (IntegerL 1))) (AppT (ConT GHC.Tuple.Solo#) (ConT GHC.Num.Integer.Integer)) -GHC.Tuple.Solo# 1 :: GHC.Tuple.Solo# GHC.Num.Integer.Integer +SigE (AppE (AppE (ConE GHC.Tuple.Prim.(,)) (LitE (IntegerL 1))) (LitE (IntegerL 2))) (AppT (AppT (ConT GHC.Tuple.Prim.(,)) (ConT GHC.Num.Integer.Integer)) (ConT GHC.Num.Integer.Integer)) +GHC.Tuple.Prim.(,) 1 2 :: GHC.Tuple.Prim.(,) GHC.Num.Integer.Integer + GHC.Num.Integer.Integer +SigE (AppE (ConE GHC.Tuple.Prim.MkSolo) (LitE (IntegerL 1))) (AppT (ConT GHC.Tuple.Prim.Solo) (ConT GHC.Num.Integer.Integer)) +GHC.Tuple.Prim.MkSolo 1 :: GHC.Tuple.Prim.Solo GHC.Num.Integer.Integer +SigE (AppE (AppE (ConE GHC.Tuple.Prim.(#,#)) (LitE (IntegerL 1))) (LitE (IntegerL 2))) (AppT (AppT (ConT GHC.Tuple.Prim.(#,#)) (ConT GHC.Num.Integer.Integer)) (ConT GHC.Num.Integer.Integer)) +GHC.Tuple.Prim.(#,#) 1 2 :: GHC.Tuple.Prim.(#,#) GHC.Num.Integer.Integer + GHC.Num.Integer.Integer +SigE (AppE (ConE GHC.Tuple.Prim.Solo#) (LitE (IntegerL 1))) (AppT (ConT GHC.Tuple.Prim.Solo#) (ConT GHC.Num.Integer.Integer)) +GHC.Tuple.Prim.Solo# 1 :: GHC.Tuple.Prim.Solo# GHC.Num.Integer.Integer diff --git a/testsuite/tests/th/overloaded/TH_overloaded_csp.stdout b/testsuite/tests/th/overloaded/TH_overloaded_csp.stdout index 5a64654110..95bb18b003 100644 --- a/testsuite/tests/th/overloaded/TH_overloaded_csp.stdout +++ b/testsuite/tests/th/overloaded/TH_overloaded_csp.stdout @@ -1,2 +1,2 @@ -ConE GHC.Tuple.() -ConE GHC.Tuple.() +ConE GHC.Tuple.Prim.() +ConE GHC.Tuple.Prim.() diff --git a/testsuite/tests/th/overloaded/TH_overloaded_extract.stdout b/testsuite/tests/th/overloaded/TH_overloaded_extract.stdout index d245bb9cee..095d71c638 100644 --- a/testsuite/tests/th/overloaded/TH_overloaded_extract.stdout +++ b/testsuite/tests/th/overloaded/TH_overloaded_extract.stdout @@ -1,6 +1,6 @@ InfixE (Just (LitE (IntegerL 1))) (VarE GHC.Num.+) (Just (LitE (IntegerL 2))) LamE [VarP x] (InfixE (Just (LitE (IntegerL 1))) (VarE GHC.Num.+) (Just (LitE (IntegerL 2)))) [DataD [] Foo [] Nothing [NormalC Foo []] []] -ConP GHC.Tuple.() [] [] +ConP GHC.Tuple.Prim.() [] [] AppT ListT (ConT GHC.Types.Int) InfixE Nothing (VarE GHC.Num.+) (Just (LitE (IntegerL 1))) diff --git a/testsuite/tests/typecheck/should_compile/T18529.stderr b/testsuite/tests/typecheck/should_compile/T18529.stderr index 48f66e43c9..71bb9d715b 100644 --- a/testsuite/tests/typecheck/should_compile/T18529.stderr +++ b/testsuite/tests/typecheck/should_compile/T18529.stderr @@ -28,7 +28,7 @@ $krep [InlPrag=[~]] = GHC.Types.KindRepTyConApp GHC.Types.$tcConstraint [] @GHC.Types.KindRep $krep [InlPrag=[~]] - = GHC.Types.KindRepTyConApp GHC.Tuple.$tc() [] @GHC.Types.KindRep + = GHC.Types.KindRepTyConApp GHC.Tuple.Prim.$tc() [] @GHC.Types.KindRep $krep [InlPrag=[~]] = GHC.Types.KindRepTyConApp Bug.$tcC diff --git a/testsuite/tests/typecheck/should_compile/holes.stderr b/testsuite/tests/typecheck/should_compile/holes.stderr index 8416f0a4fc..5dfb035931 100644 --- a/testsuite/tests/typecheck/should_compile/holes.stderr +++ b/testsuite/tests/typecheck/should_compile/holes.stderr @@ -88,7 +88,7 @@ holes.hs:11:15: warning: [GHC-88464] [-Wtyped-holes (in -Wdefault)] Nothing :: forall a. Maybe a Just :: forall a. a -> Maybe a [] :: forall a. [a] - Solo :: forall a. a -> Solo a + MkSolo :: forall a. a -> Solo a asTypeOf :: forall a. a -> a -> a id :: forall a. a -> a until :: forall a. (a -> Bool) -> (a -> a) -> a -> a diff --git a/testsuite/tests/typecheck/should_compile/holes3.stderr b/testsuite/tests/typecheck/should_compile/holes3.stderr index 8032042b90..72b16b9e5d 100644 --- a/testsuite/tests/typecheck/should_compile/holes3.stderr +++ b/testsuite/tests/typecheck/should_compile/holes3.stderr @@ -91,7 +91,7 @@ holes3.hs:11:15: error: [GHC-88464] Nothing :: forall a. Maybe a Just :: forall a. a -> Maybe a [] :: forall a. [a] - Solo :: forall a. a -> Solo a + MkSolo :: forall a. a -> Solo a asTypeOf :: forall a. a -> a -> a id :: forall a. a -> a until :: forall a. (a -> Bool) -> (a -> a) -> a -> a diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr index d8344711fe..4ef63821ca 100644 --- a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr @@ -148,8 +148,8 @@ valid_hole_fits.hs:34:11: warning: [GHC-88464] [-Wtyped-holes (in -Wdefault)] with Just @Bool (imported from ‘Data.Maybe’ at valid_hole_fits.hs:5:1-17 (and originally defined in ‘GHC.Maybe’)) - Solo :: forall a. a -> Solo a - with Solo @Bool + MkSolo :: forall a. a -> Solo a + with MkSolo @Bool (bound at <wired into compiler>) id :: forall a. a -> a with id @Bool diff --git a/utils/haddock b/utils/haddock -Subproject 7e4326f999056fb7b0b955ccadf5eab86b755a0 +Subproject f114ba7fc0751f53766e2c3089e234927237a98 |