diff options
author | Bartosz Nitka <niteria@gmail.com> | 2015-10-30 23:40:21 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-30 23:40:34 +0100 |
commit | a5cb27f323a0c78f61db1a3c5338045b0981850b (patch) | |
tree | 91eb409d2cc10b00840f8c783744fc1e3939c1ad /compiler/ghc.mk | |
parent | fce758c5a5a54e8cfa491c5168893854bf7e974d (diff) | |
download | haskell-a5cb27f323a0c78f61db1a3c5338045b0981850b.tar.gz |
Make type-class dictionary let binds deterministic
When generating dictionary let binds in dsTcEvBinds we may
end up generating them in arbitrary order according to Unique order.
Consider:
```
let $dEq = GHC.Classes.$fEqInt in
let $$dNum = GHC.Num.$fNumInt in ...
```
vs
```
let $dNum = GHC.Num.$fNumInt in
let $dEq = GHC.Classes.$fEqInt in ...
```
The way this change fixes it is by using `UniqDFM` - a type of
deterministic finite maps of things keyed on `Unique`s. This way when
you pull out evidence variables corresponding to type-class dictionaries
they are in deterministic order.
Currently it's the order of insertion and the way it's implemented is by
tagging the values with the time of insertion.
Test Plan:
I've added a new test case to reproduce the issue.
./validate
Reviewers: ezyang, simonmar, austin, simonpj, bgamari
Reviewed By: simonmar, simonpj, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1396
GHC Trac Issues: #4012
Diffstat (limited to 'compiler/ghc.mk')
-rw-r--r-- | compiler/ghc.mk | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 5883b8a3c0..26e22b4840 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -580,6 +580,7 @@ compiler_stage2_dll0_MODULES = \ TysWiredIn \ Unify \ UniqFM \ + UniqDFM \ UniqSet \ UniqSupply \ Unique \ |