diff options
author | Ben Gamari <ben@smart-cactus.org> | 2017-02-01 20:25:33 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-18 00:07:03 -0500 |
commit | b207b536ded40156f9adb168565ca78e1eef2c74 (patch) | |
tree | c7e074201603ac54abb60856010ef82478a2113d /testsuite/tests | |
parent | efeaf9e436109cb35b491e08b5407c0598108186 (diff) | |
download | haskell-b207b536ded40156f9adb168565ca78e1eef2c74.tar.gz |
Generalize kind of the (->) tycon
This is generalizes the kind of `(->)`, as discussed in #11714.
This involves a few things,
* Generalizing the kind of `funTyCon`, adding two new `RuntimeRep`
binders,
```lang=haskell
(->) :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
(a :: TYPE r1) (b :: TYPE r2).
a -> b -> *
```
* Unsaturated applications of `(->)` are expressed as explicit
`TyConApp`s
* Saturated applications of `(->)` are expressed as `FunTy` as they are
currently
* Saturated applications of `(->)` are expressed by a new `FunCo`
constructor in coercions
* `splitTyConApp` needs to ensure that `FunTy`s are split to a
`TyConApp`
of `(->)` with the appropriate `RuntimeRep` arguments
* Teach CoreLint to check that all saturated applications of `(->)` are
represented with `FunTy`
At the moment I assume that `Constraint ~ *`, which is an annoying
source of complexity. This will
be simplified once D3023 is resolved.
Also, this introduces two known regressions,
`tcfail181`, `T10403`
=====================
Only shows the instance,
instance Monad ((->) r) -- Defined in ‘GHC.Base’
in its error message when -fprint-potential-instances is used. This is
because its instance head now mentions 'LiftedRep which is not in scope.
I'm not entirely sure of the right way to fix this so I'm just accepting
the new output for now.
T5963 (Typeable)
================
T5963 is now broken since Data.Typeable.Internals.mkFunTy computes its
fingerprint without the RuntimeRep variables that (->) expects. This
will be fixed with the merge of D2010.
Haddock performance
===================
The `haddock.base` and `haddock.Cabal` tests regress in allocations by
about 20%. This certainly hurts, but it's also not entirely unexpected:
the size of every function type grows with this patch and Haddock has a
lot of functions in its heap.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/ghci/scripts/T8535.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci020.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/should_run/T10145.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/T10403.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/perf/compiler/all.T | 3 | ||||
-rw-r--r-- | testsuite/tests/perf/haddock/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/tc167.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/tcfail181.stderr | 5 |
9 files changed, 15 insertions, 16 deletions
diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/scripts/T8535.stdout index 7245bf2d3d..2aea35f3de 100644 --- a/testsuite/tests/ghci/scripts/T8535.stdout +++ b/testsuite/tests/ghci/scripts/T8535.stdout @@ -1,4 +1,4 @@ -data (->) a b -- Defined in ‘GHC.Prim’ +data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ instance Applicative ((->) a) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/ghci020.stdout b/testsuite/tests/ghci/scripts/ghci020.stdout index 7245bf2d3d..2aea35f3de 100644 --- a/testsuite/tests/ghci/scripts/ghci020.stdout +++ b/testsuite/tests/ghci/scripts/ghci020.stdout @@ -1,4 +1,4 @@ -data (->) a b -- Defined in ‘GHC.Prim’ +data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ instance Applicative ((->) a) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/should_run/T10145.stdout b/testsuite/tests/ghci/should_run/T10145.stdout index 7245bf2d3d..2aea35f3de 100644 --- a/testsuite/tests/ghci/should_run/T10145.stdout +++ b/testsuite/tests/ghci/should_run/T10145.stdout @@ -1,4 +1,4 @@ -data (->) a b -- Defined in ‘GHC.Prim’ +data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ instance Applicative ((->) a) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr index 0588c1b5bc..3027d17d1b 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -41,7 +41,8 @@ T10403.hs:22:15: warning: [-Wdeferred-type-errors (in -Wdefault)] instance Functor IO -- Defined in ‘GHC.Base’ instance Functor (B t) -- Defined at T10403.hs:10:10 instance Functor I -- Defined at T10403.hs:6:10 - ...plus four others + ...plus three others + ...plus one instance involving out-of-scope types (use -fprint-potential-instances to see them all) • In the second argument of ‘(.)’, namely ‘fmap (const ())’ In the expression: H . fmap (const ()) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 0592bd6800..5f898fbbee 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -737,13 +737,14 @@ test('T9675', test('T9872a', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 3134866040 , 5), + [(wordsize(64), 3304620816, 5), # 2014-12-10 5521332656 Initally created # 2014-12-16 5848657456 Flattener parameterized over roles # 2014-12-18 2680733672 Reduce type families even more eagerly # 2015-12-11 3581500440 TypeInType (see #11196) # 2016-04-07 3352882080 CSE improvements # 2016-10-19 3134866040 Refactor traceRn interface (#12617) + # 2017-02-01 3304620816 (wordsize(32), 1740903516, 5) # was 1325592896 # 2016-04-06 1740903516 x86/Linux diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 5ed6758cfc..4c641d5828 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -5,7 +5,7 @@ test('haddock.base', [unless(in_tree_compiler(), skip), req_haddock ,stats_num_field('bytes allocated', - [(wordsize(64), 32695562088, 5) + [(wordsize(64), 38425793776, 5) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) @@ -33,6 +33,7 @@ test('haddock.base', # 2017-01-11: 31115778088 (x86_64/Linux) - Join points (#12988) # 2017-02-11: 34819979936 (x86_64/Linux) - OccurAnal / One-Shot (#13227) # 2017-02-16: 32695562088 Better Lint for join points + # 2017-02-17: 38425793776 (x86_64/Linux) - Generalize kind of (->) ,(platform('i386-unknown-mingw32'), 4434804940, 5) # 2013-02-10: 3358693084 (x86/Windows) @@ -55,7 +56,7 @@ test('haddock.base', test('haddock.Cabal', [unless(in_tree_compiler(), skip), req_haddock ,stats_num_field('bytes allocated', - [(wordsize(64), 23867276992, 5) + [(wordsize(64), 27784875792, 5) # 2012-08-14: 3255435248 (amd64/Linux) # 2012-08-29: 3324606664 (amd64/Linux, new codegen) # 2012-10-08: 3373401360 (amd64/Linux) @@ -98,6 +99,7 @@ test('haddock.Cabal', # 2017-01-14: 23272708864 (amd64/Linux) - Join points (#12988) # 2017-02-11: 25533642168 (amd64/Linux) - OccurAnal / One-Shot (#13227) # 2017-02-16: 23867276992 Better Lint for join points + # 2017-02-17: 27784875792 (amd64/Linux) - Generalize kind of (->) ,(platform('i386-unknown-mingw32'), 3293415576, 5) # 2012-10-30: 1733638168 (x86/Windows) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index c44ab9153c..8a5610d848 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -167,7 +167,7 @@ test('tc163', normal, compile, ['']) test('tc164', normal, compile, ['']) test('tc165', expect_broken_for(10181, ['optasm', 'optllvm']), compile, ['']) test('tc166', normal, compile, ['']) -test('tc167', normal, compile_fail, ['']) +test('tc167', normal, compile, ['']) test('tc168', normal, compile_fail, ['']) test('tc169', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/tc167.stderr b/testsuite/tests/typecheck/should_compile/tc167.stderr deleted file mode 100644 index 634b50dd5b..0000000000 --- a/testsuite/tests/typecheck/should_compile/tc167.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -tc167.hs:8:15: - Expecting a lifted type, but ‘Int#’ is unlifted - In the first argument of ‘(->)’, namely ‘Int#’ - In the type ‘(->) Int#’ - In the type declaration for ‘T’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr index 30e27b8bb7..3ab08676b5 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr @@ -9,8 +9,9 @@ tcfail181.hs:17:9: error: These potential instances exist: instance Monad IO -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ - instance Monad ((->) r) -- Defined in ‘GHC.Base’ - ...plus two others + instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ + ...plus one other + ...plus one instance involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: foo In the expression: foo {bar = return True} |