[commit: ghc] wip/spj-tc-branch2: Make TcLevel increase by 1 not 2 (2d960f2)
git at git.haskell.org
git at git.haskell.org
Fri Sep 30 15:17:47 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/spj-tc-branch2
Link : http://ghc.haskell.org/trac/ghc/changeset/2d960f225483d1c428992893ee637987af90b2cb/ghc
>---------------------------------------------------------------
commit 2d960f225483d1c428992893ee637987af90b2cb
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Sep 20 23:29:51 2016 +0100
Make TcLevel increase by 1 not 2
Make the TcLevel of a flatten-meta-var be always zero.
See TcType.fmvTcLevel.
This allows the levels of implication constraints to to
up by 1 each time instead of 2, which is less confusing.
This change has no effect on type checking.
>---------------------------------------------------------------
2d960f225483d1c428992893ee637987af90b2cb
compiler/typecheck/TcType.hs | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index bd64f54..193060b 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -646,23 +646,18 @@ Note [TcLevel assignment]
~~~~~~~~~~~~~~~~~~~~~~~~~
We arrange the TcLevels like this
+ 0 Level for flatten meta-vars
1 Top level
- 2 Flatten-meta-vars of level 3
- 3 First-level implication constraints
- 4 Flatten-meta-vars of level 5
- 5 Second-level implication constraints
+ 2 First-level implication constraints
+ 3 Second-level implication constraints
...etc...
-The even-numbered levels are for the flatten-meta-variables assigned
-at the next level in. Eg for a second-level implication conststraint
-(level 5), the flatten meta-vars are level 4, which makes them untouchable.
-The flatten meta-vars could equally well all have level 0, or just NotALevel
-since they do not live across implications.
+The flatten meta-vars are all at level 0, just to make them untouchable.
-}
fmvTcLevel :: TcLevel -> TcLevel
-- See Note [TcLevel assignment]
-fmvTcLevel (TcLevel n) = TcLevel (n-1)
+fmvTcLevel _ = TcLevel 0
topTcLevel :: TcLevel
-- See Note [TcLevel assignment]
@@ -674,7 +669,7 @@ isTopTcLevel _ = False
pushTcLevel :: TcLevel -> TcLevel
-- See Note [TcLevel assignment]
-pushTcLevel (TcLevel us) = TcLevel (us + 2)
+pushTcLevel (TcLevel us) = TcLevel (us + 1)
strictlyDeeperThan :: TcLevel -> TcLevel -> Bool
strictlyDeeperThan (TcLevel tv_tclvl) (TcLevel ctxt_tclvl)
More information about the ghc-commits
mailing list