diff options
author | Iavor S. Diatchki <diatchki@galois.com> | 2015-03-07 10:37:31 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-03-07 10:38:30 -0600 |
commit | b359c886cd7578ed083bcedcea05d315ecaeeb54 (patch) | |
tree | bb1959149dde78d29614966131841a77fa38bbab /testsuite/tests/ghci.debugger | |
parent | 479523f3c37894d63352f1718e06696f3ed63143 (diff) | |
download | haskell-b359c886cd7578ed083bcedcea05d315ecaeeb54.tar.gz |
Custom `Typeable` solver, that keeps track of kinds.
Summary:
This implements the new `Typeable` solver: when GHC sees `Typeable` constraints
it solves them on the spot.
The current implementation creates `TyCon` representations on the spot.
Pro: No overhead at all in code that does not use `Typeable`
Cons: Code that uses `Typeable` may create multipe `TyCon` represntations.
We have discussed an implementation where representations of `TyCons` are
computed once, in the module, where a datatype is declared. This would
lead to more code being generated: for a promotable datatype we need to
generate `2 + number_of_data_cons` type-constructro representations,
and we have to do that for all programs, even ones that do not intend to
use typeable.
I added code to emit warning whenevar `deriving Typeable` is encountered---
the idea being that this is not needed anymore, and shold be fixed.
Also, we allow `instance Typeable T` in .hs-boot files, but they result
in a warning, and are ignored. This last one was to avoid breaking exisitng
code, and should become an error, eventually.
Test Plan:
1. GHC can compile itself.
2. I compiled a number of large libraries, including `lens`.
- I had to make some small changes:
`unordered-containers` uses internals of `TypeReps`, so I had to do a 1 line fix
- `lens` needed one instance changed, due to a poly-kinded `Typeble` instance
3. I also run some code that uses `syb` to traverse a largish datastrucutre.
I didn't notice any signifiant performance difference between the 7.8.3 version,
and this implementation.
Reviewers: simonpj, simonmar, austin, hvr
Reviewed By: austin, hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D652
GHC Trac Issues: #9858
Diffstat (limited to 'testsuite/tests/ghci.debugger')
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/print019.stderr | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr index 139ce8d111..0c92dba4e4 100644 --- a/testsuite/tests/ghci.debugger/scripts/print019.stderr +++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr @@ -5,12 +5,8 @@ Use :print or :force to determine these types Relevant bindings include it :: a1 (bound at <interactive>:11:1) Note: there are several potential instances: - instance forall (k :: BOX) (s :: k). Show (Proxy s) - -- Defined in ‘Data.Proxy’ - instance forall (k :: BOX) (a :: k) (b :: k). - Show (Data.Type.Coercion.Coercion a b) - -- Defined in ‘Data.Type.Coercion’ - instance forall (k :: BOX) (a :: k) (b :: k). Show (a :~: b) - -- Defined in ‘Data.Type.Equality’ - ...plus 47 others + instance Show TyCon -- Defined in ‘Data.Typeable.Internal’ + instance Show TypeRep -- Defined in ‘Data.Typeable.Internal’ + instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ + ...plus 30 others In a stmt of an interactive GHCi command: print it |