diff options
author | Andrei Borzenkov <andreyborzenkov2002@gmail.com> | 2023-01-27 17:48:33 +0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-03-21 11:17:17 -0400 |
commit | a13affce1a6196ccff6c126112ab26823c85e727 (patch) | |
tree | f93cabe0d62bfe2c809437a885019bc92418a9c3 /testsuite | |
parent | 73d07c6e1986bd2b3516d4f009cc1e30ba804f06 (diff) | |
download | haskell-a13affce1a6196ccff6c126112ab26823c85e727.tar.gz |
Rename () into Unit, (,,...,,) into Tuple<n> (#21294)
This patch implements a part of GHC Proposal #475.
The key change is in GHC.Tuple.Prim:
- data () = ()
- data (a,b) = (a,b)
- data (a,b,c) = (a,b,c)
...
+ data Unit = ()
+ data Tuple2 a b = (a,b)
+ data Tuple3 a b c = (a,b,c)
...
And the rest of the patch makes sure that Unit and Tuple<n>
are pretty-printed as () and (,,...,,) in various contexts.
Updates the haddock submodule.
Co-authored-by: Vladislav Zavialov <vlad.z.4096@gmail.com>
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghc-api/T18522-dbg-ppr.stdout | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T12550.stdout | 10 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T4127.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T4175.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T7627.stdout | 14 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci011.stdout | 10 | ||||
-rw-r--r-- | testsuite/tests/hiefile/should_run/HieQueries.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/module/TupleTyConUserSyntax.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/module/TupleTyConUserSyntaxA.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/module/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/roles/should_compile/T8958.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T21119.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T21888.stderr | 12 | ||||
-rw-r--r-- | testsuite/tests/th/T12478_4.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T18529.stderr | 4 |
16 files changed, 64 insertions, 39 deletions
diff --git a/testsuite/tests/ghc-api/T18522-dbg-ppr.stdout b/testsuite/tests/ghc-api/T18522-dbg-ppr.stdout index c6e1d209e7..7daf9caf45 100644 --- a/testsuite/tests/ghc-api/T18522-dbg-ppr.stdout +++ b/testsuite/tests/ghc-api/T18522-dbg-ppr.stdout @@ -1,2 +1 @@ -forall k{tv}[tv] {j{tv}[tv]}. -forall a{tv}[tv] b{tv}[tv] -> (){(w) tc} +forall k{tv}[tv] {j{tv}[tv]}. forall a{tv}[tv] b{tv}[tv] -> () diff --git a/testsuite/tests/ghci/scripts/T12550.stdout b/testsuite/tests/ghci/scripts/T12550.stdout index 5c2dccb767..6d76942568 100644 --- a/testsuite/tests/ghci/scripts/T12550.stdout +++ b/testsuite/tests/ghci/scripts/T12550.stdout @@ -23,6 +23,11 @@ class Functor f where (<$) ∷ ∀ a b. a → f b → f a {-# MINIMAL fmap #-} -- Defined in ‘GHC.Base’ +instance ∀ r. Functor ((->) r) -- Defined in ‘GHC.Base’ +instance Functor IO -- Defined in ‘GHC.Base’ +instance Functor [] -- Defined in ‘GHC.Base’ +instance Functor Maybe -- Defined in ‘GHC.Base’ +instance Functor Solo -- Defined in ‘GHC.Base’ instance ∀ a. Functor ((,) a) -- Defined in ‘GHC.Base’ instance ∀ a b. Functor ((,,) a b) -- Defined in ‘GHC.Base’ instance ∀ a b c. Functor ((,,,) a b c) -- Defined in ‘GHC.Base’ @@ -32,11 +37,6 @@ instance ∀ a b c d e. Functor ((,,,,,) a b c d e) -- Defined in ‘GHC.Base’ instance ∀ a b c d e f. Functor ((,,,,,,) a b c d e f) -- Defined in ‘GHC.Base’ -instance ∀ r. Functor ((->) r) -- Defined in ‘GHC.Base’ -instance Functor IO -- Defined in ‘GHC.Base’ -instance Functor [] -- Defined in ‘GHC.Base’ -instance Functor Maybe -- Defined in ‘GHC.Base’ -instance Functor Solo -- Defined in ‘GHC.Base’ instance ∀ a. Functor (Either a) -- Defined in ‘Data.Either’ instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★). (Functor f, Functor g) ⇒ diff --git a/testsuite/tests/ghci/scripts/T4127.stdout b/testsuite/tests/ghci/scripts/T4127.stdout index 3d2fad2539..d1cab7c0cc 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.Prim.(,)) (VarT a_0))) [ValD (VarP GHC.Base.>>=) (NormalB (VarE GHC.Err.undefined)) []]] +[InstanceD Nothing [] (AppT (ConT GHC.Base.Monad) (AppT (ConT GHC.Tuple.Prim.Tuple2) (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 16b2ebc26a..c014d96b51 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -22,8 +22,8 @@ type family E a where E () = Bool E Int = String -- Defined at T4175.hs:25:1 -type () :: * -data () = () +type Unit :: * +data Unit = () -- Defined in ‘GHC.Tuple.Prim’ instance [safe] C () -- Defined at T4175.hs:22:10 instance Monoid () -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout index ba4640d01b..9deefb75a1 100644 --- a/testsuite/tests/ghci/scripts/T7627.stdout +++ b/testsuite/tests/ghci/scripts/T7627.stdout @@ -1,5 +1,5 @@ -type () :: * -data () = () +type Unit :: * +data Unit = () -- Defined in ‘GHC.Tuple.Prim’ instance Monoid () -- Defined in ‘GHC.Base’ instance Semigroup () -- Defined in ‘GHC.Base’ @@ -16,8 +16,8 @@ data (##) = (##) (##) :: (# #) ( ) :: () (# #) :: (# #) -type (,) :: * -> * -> * -data (,) a b = (,) a b +type Tuple2 :: * -> * -> * +data Tuple2 a b = (,) a b -- Defined in ‘GHC.Tuple.Prim’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ instance (Monoid a, Monoid b) => Monoid (a, b) @@ -27,13 +27,13 @@ instance (Semigroup a, Semigroup b) => Semigroup (a, b) instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ instance (Bounded a, Bounded b) => Bounded (a, b) -- Defined in ‘GHC.Enum’ -instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ -instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’ instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ -instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’ instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ instance Functor ((,) a) -- Defined in ‘GHC.Base’ instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ +instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ +instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’ +instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’ type (#,#) :: * -> * -> TYPE diff --git a/testsuite/tests/ghci/scripts/ghci011.stdout b/testsuite/tests/ghci/scripts/ghci011.stdout index 32190117fd..e0fbe20927 100644 --- a/testsuite/tests/ghci/scripts/ghci011.stdout +++ b/testsuite/tests/ghci/scripts/ghci011.stdout @@ -13,8 +13,8 @@ instance MonadFail [] -- Defined in ‘Control.Monad.Fail’ instance Monad [] -- Defined in ‘GHC.Base’ instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’ -type () :: * -data () = () +type Unit :: * +data Unit = () -- Defined in ‘GHC.Tuple.Prim’ instance Monoid () -- Defined in ‘GHC.Base’ instance Semigroup () -- Defined in ‘GHC.Base’ @@ -24,8 +24,8 @@ instance Enum () -- Defined in ‘GHC.Enum’ instance Ord () -- Defined in ‘GHC.Classes’ instance Show () -- Defined in ‘GHC.Show’ instance Eq () -- Defined in ‘GHC.Classes’ -type (,) :: * -> * -> * -data (,) a b = (,) a b +type Tuple2 :: * -> * -> * +data Tuple2 a b = (,) a b -- Defined in ‘GHC.Tuple.Prim’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ instance (Monoid a, Monoid b) => Monoid (a, b) @@ -35,9 +35,9 @@ instance (Semigroup a, Semigroup b) => Semigroup (a, b) instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ instance (Bounded a, Bounded b) => Bounded (a, b) -- Defined in ‘GHC.Enum’ +instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’ -instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’ instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ instance Functor ((,) a) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/hiefile/should_run/HieQueries.stdout b/testsuite/tests/hiefile/should_run/HieQueries.stdout index 11fc74a84f..42492acb0c 100644 --- a/testsuite/tests/hiefile/should_run/HieQueries.stdout +++ b/testsuite/tests/hiefile/should_run/HieQueries.stdout @@ -46,7 +46,7 @@ At point (23,9), we found: | `- ┌ │ $dShow at HieQueries.hs:23:1-22, of type: Show (Integer, x, A) - │ is an evidence variable bound by a let, depending on: [$fShow(,,), + │ is an evidence variable bound by a let, depending on: [$fShowTuple3, │ $dShow, $dShow, $dShow] │ with scope: LocalScope HieQueries.hs:23:1-22 │ bound at: HieQueries.hs:23:1-22 @@ -54,7 +54,7 @@ At point (23,9), we found: └ | +- ┌ - | │ $fShow(,,) at HieQueries.hs:23:1-22, of type: forall a b c. (Show a, Show b, Show c) => Show (a, b, c) + | │ $fShowTuple3 at HieQueries.hs:23:1-22, of type: forall a b c. (Show a, Show b, Show c) => Show (a, b, c) | │ is a usage of an external evidence variable | │ Defined in `GHC.Show' | └ diff --git a/testsuite/tests/module/TupleTyConUserSyntax.hs b/testsuite/tests/module/TupleTyConUserSyntax.hs new file mode 100644 index 0000000000..12501795bd --- /dev/null +++ b/testsuite/tests/module/TupleTyConUserSyntax.hs @@ -0,0 +1,13 @@ +module TupleTyConUserSyntax where + +import TupleTyConUserSyntaxA + +type T1 = Tuple1 + +type T2 = Tuple2 + +type T23 = Tuple23 + +type T46 = Tuple46 + +type T64 = Tuple64
\ No newline at end of file diff --git a/testsuite/tests/module/TupleTyConUserSyntaxA.hs b/testsuite/tests/module/TupleTyConUserSyntaxA.hs new file mode 100644 index 0000000000..086e9a905d --- /dev/null +++ b/testsuite/tests/module/TupleTyConUserSyntaxA.hs @@ -0,0 +1,11 @@ +module TupleTyConUserSyntaxA (module GHC.Tuple) where + +import GHC.Tuple + +type T1 = Tuple1 + +type T2 = Tuple2 + +type T23 = Tuple23 + +type T64 = Tuple64
\ No newline at end of file diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T index 415f40717e..516a252b8c 100644 --- a/testsuite/tests/module/all.T +++ b/testsuite/tests/module/all.T @@ -295,3 +295,5 @@ test('T13704b', [], multimod_compile, ['T13704b1.hs T13704b2.hs', '-main-is T137 test('T20562', normal, compile, ['']) test('T21752', [extra_files(['T21752A.hs', 'T21752.hs'])], multimod_compile, ['T21752', '-v0']) + +test('TupleTyConUserSyntax', [extra_files(['TupleTyConUserSyntaxA.hs', 'TupleTyConUserSyntax.hs'])], multimod_compile, ['TupleTyConUserSyntax', '-v0']) diff --git a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr index 388ba5a0a1..806bda59fb 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr @@ -8,7 +8,7 @@ NamedWildcardsNotInMonotype.hs:5:1: error: [GHC-39999] The type variable ‘w0’ is ambiguous Potentially matching instances: instance Eq Ordering -- Defined in ‘GHC.Classes’ - instance Eq () -- Defined in ‘GHC.Classes’ + instance Eq a => Eq (Solo a) -- Defined in ‘GHC.Classes’ ...plus 22 others ...plus four instances involving out-of-scope types (use -fprint-potential-instances to see them all) diff --git a/testsuite/tests/roles/should_compile/T8958.stderr b/testsuite/tests/roles/should_compile/T8958.stderr index ec5ede1aa1..9a8e781e67 100644 --- a/testsuite/tests/roles/should_compile/T8958.stderr +++ b/testsuite/tests/roles/should_compile/T8958.stderr @@ -18,7 +18,7 @@ CLASS INSTANCES -- Defined at T8958.hs:11:10 instance [incoherent] Nominal a -- Defined at T8958.hs:8:10 Dependent modules: [] -Dependent packages: [base-4.17.0.0] +Dependent packages: [base-4.18.0.0] ==================== Typechecker ==================== T8958.$tcMap @@ -53,7 +53,7 @@ $krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* GHC.Types.krep$Constraint $krep [InlPrag=[~]] = GHC.Types.KindRepTyConApp - GHC.Tuple.Prim.$tc(,) + GHC.Tuple.Prim.$tcTuple2 ((:) @GHC.Types.KindRep $krep ((:) @GHC.Types.KindRep $krep [] @GHC.Types.KindRep)) $krep [InlPrag=[~]] diff --git a/testsuite/tests/stranal/sigs/T21119.stderr b/testsuite/tests/stranal/sigs/T21119.stderr index 1c27b4c9a4..a0549af229 100644 --- a/testsuite/tests/stranal/sigs/T21119.stderr +++ b/testsuite/tests/stranal/sigs/T21119.stderr @@ -1,7 +1,7 @@ ==================== Strictness signatures ==================== -T21119.$fMyShow(,): <1!A> T21119.$fMyShowInt: <1!A> +T21119.$fMyShowTuple2: <1!A> T21119.get: <1!P(1!P(L),1!P(L))><1!P(L)><1L> T21119.getIO: <1P(1L,ML)><1L><ML><L> T21119.indexError: <1C(1,L)><1!B><S!S><S>b @@ -10,8 +10,8 @@ T21119.throwIndexError: <MC(1,L)><MA><L><L><L>x ==================== Cpr signatures ==================== -T21119.$fMyShow(,): T21119.$fMyShowInt: +T21119.$fMyShowTuple2: T21119.get: T21119.getIO: 1 T21119.indexError: b @@ -20,8 +20,8 @@ T21119.throwIndexError: b ==================== Strictness signatures ==================== -T21119.$fMyShow(,): <1!A> T21119.$fMyShowInt: <1!A> +T21119.$fMyShowTuple2: <1!A> T21119.get: <1!P(1!P(L),1!P(L))><1!P(L)><1L> T21119.getIO: <1P(1L,ML)><1L><ML><L> T21119.indexError: <1C(1,L)><1!B><S!S><S>b diff --git a/testsuite/tests/stranal/sigs/T21888.stderr b/testsuite/tests/stranal/sigs/T21888.stderr index d52d0c7d78..ff046ca2cf 100644 --- a/testsuite/tests/stranal/sigs/T21888.stderr +++ b/testsuite/tests/stranal/sigs/T21888.stderr @@ -1,30 +1,30 @@ ==================== Strictness signatures ==================== -Data.MemoTrie.$fHasTrie(): <L> -Data.MemoTrie.$fHasTrie(,): <1C(1,L)><LC(S,L)><L> Data.MemoTrie.$fHasTrieBool: <1!P(L,L)> Data.MemoTrie.$fHasTrieEither: <1C(1,L)><1C(1,L)><1!P(L,L)> Data.MemoTrie.$fHasTrieInteger: <1!P(1!P(S,1!P(1!P(S,1L),1!P(S,1L))),1!P(S,1!P(1!P(S,1L),1!P(S,1L))))>b Data.MemoTrie.$fHasTrieList: <SC(S,L)><1!P(L,L)> +Data.MemoTrie.$fHasTrieTuple2: <1C(1,L)><LC(S,L)><L> +Data.MemoTrie.$fHasTrieUnit: <L> ==================== Cpr signatures ==================== -Data.MemoTrie.$fHasTrie(): -Data.MemoTrie.$fHasTrie(,): Data.MemoTrie.$fHasTrieBool: Data.MemoTrie.$fHasTrieEither: Data.MemoTrie.$fHasTrieInteger: Data.MemoTrie.$fHasTrieList: +Data.MemoTrie.$fHasTrieTuple2: +Data.MemoTrie.$fHasTrieUnit: ==================== Strictness signatures ==================== -Data.MemoTrie.$fHasTrie(): <L> -Data.MemoTrie.$fHasTrie(,): <1C(1,L)><LC(S,L)><L> Data.MemoTrie.$fHasTrieBool: <1!P(L,L)> Data.MemoTrie.$fHasTrieEither: <1C(1,L)><1C(1,L)><1!P(L,L)> Data.MemoTrie.$fHasTrieInteger: <1!P(1!P(B,1!P(1!P(B,1!P(L,L)),1!P(B,1!P(L,L)))),1!P(B,1!P(1!B,1!B)))>b Data.MemoTrie.$fHasTrieList: <SC(S,L)><1!P(L,L)> +Data.MemoTrie.$fHasTrieTuple2: <1C(1,L)><LC(S,L)><L> +Data.MemoTrie.$fHasTrieUnit: <L> diff --git a/testsuite/tests/th/T12478_4.stderr b/testsuite/tests/th/T12478_4.stderr index 2f1b3f4e50..852b104cd5 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: [GHC-97721] • Illegal sum arity: 1 Sums must have an arity of at least 2 - When splicing a TH type: (# #) GHC.Tuple.Prim.() + When splicing a TH type: (# #) GHC.Tuple.Prim.Unit • In the untyped splice: $(unboxedSumT 1 `appT` conT ''()) diff --git a/testsuite/tests/typecheck/should_compile/T18529.stderr b/testsuite/tests/typecheck/should_compile/T18529.stderr index 71542931fc..21b41159d4 100644 --- a/testsuite/tests/typecheck/should_compile/T18529.stderr +++ b/testsuite/tests/typecheck/should_compile/T18529.stderr @@ -6,7 +6,7 @@ TYPE CONSTRUCTORS COERCION AXIOMS axiom Bug.N:C :: forall a b. C a b = a -> b -> () Dependent modules: [] -Dependent packages: [base-4.17.0.0] +Dependent packages: [base-4.18.0.0] ==================== Typechecker ==================== Bug.$tcC @@ -32,7 +32,7 @@ $krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* GHC.Types.krep$Constraint $krep [InlPrag=[~]] = GHC.Types.KindRepTyConApp - GHC.Tuple.Prim.$tc() [] @GHC.Types.KindRep + GHC.Tuple.Prim.$tcUnit [] @GHC.Types.KindRep Bug.$trModule = GHC.Types.Module (GHC.Types.TrNameS "main"#) (GHC.Types.TrNameS "Bug"#) |