diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-07-27 09:01:46 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-07-27 09:16:11 +0100 |
commit | f265008fb6f70830e7e92ce563f6d83833cef071 (patch) | |
tree | 08b37ad197099b9d614386ea92416450038956ea /compiler/parser/Parser.y | |
parent | 4c571f3321eb8f7a06dada4c37822c22bbdd148b (diff) | |
download | haskell-f265008fb6f70830e7e92ce563f6d83833cef071.tar.gz |
Refactor (~) to reduce the suerpclass stack
The constraint (~) used to be (effectively):
class a ~~ b => (a :: k) ~ (b :: k)
but, with this patch, it is now defined uniformly with
(~~) and Coercible like this:
class a ~# b => (a :: k) ~ (b :: k)
Result:
* One less superclass selection when goinng from (~) to (~#)
Better for compile time and better for debugging with -ddump-simpl
* The code for (~), (~~), and Coercible looks uniform, and appears
together, e.g. in TysWiredIn and ClsInst.matchGlobalInst.
Previously the code for (~) was different, and unique.
Not only is this simpler, but it also makes the compiler a bit faster;
T12227: 9% less allocation
T12545: 7% less allocation
This patch fixes Trac #15421
Diffstat (limited to 'compiler/parser/Parser.y')
-rw-r--r-- | compiler/parser/Parser.y | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index d038562a73..dd9beadc4d 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -76,10 +76,9 @@ import TcEvidence ( emptyTcEvBinds ) -- compiler/prelude import ForeignCall import TysPrim ( eqPrimTyCon ) -import PrelNames ( eqTyCon_RDR ) import TysWiredIn ( unitTyCon, unitDataCon, tupleTyCon, tupleDataCon, nilDataCon, unboxedUnitTyCon, unboxedUnitDataCon, - listTyCon_RDR, consDataCon_RDR ) + listTyCon_RDR, consDataCon_RDR, eqTyCon_RDR ) -- compiler/utils import Util ( looksLikePackageName ) |