[commit: ghc] master: Fix up comment: I was just wrong previously, the original GHC comment on `oclose` is correct. (def97b8)
Iavor Diatchki
diatchki at galois.com
Mon Jan 14 19:07:05 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/def97b82b3c5f2787e6eea5ddb52d69b8e86fc82
>---------------------------------------------------------------
commit def97b82b3c5f2787e6eea5ddb52d69b8e86fc82
Author: Iavor S. Diatchki <iavor.diatchki at gmail.com>
Date: Mon Jan 14 10:07:04 2013 -0800
Fix up comment: I was just wrong previously, the original GHC comment on `oclose` is correct.
>---------------------------------------------------------------
compiler/types/FunDeps.lhs | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/compiler/types/FunDeps.lhs b/compiler/types/FunDeps.lhs
index fe8781b..cb461db 100644
--- a/compiler/types/FunDeps.lhs
+++ b/compiler/types/FunDeps.lhs
@@ -146,21 +146,22 @@ oclose preds fixed_tvs
TuplePred ts -> concatMap classesOfPredTy ts
_ -> []
--- An alternative implementation of `oclose`. Differences:
--- 1. The empty set of variables is allowed to determine stuff,
--- 2. We also use equality predicates as FDs.
>---------------------------------------------------------------
--- I (Iavor) believe that this is the correct implementation of oclose.
--- For 1: the above argument about `t` being monomorphic seems incorrect.
--- The correct behavior is to quantify over `t`, even though we know that
--- it may be instantiated to at most one type. The point is that we might
--- only find out what that type is later, at the call site to the function.
--- In general, we should be quantifying all variables that are (i) not in
--- mentioned in the environment, and (ii) not FD-determined by something in
--- the environment.
--- For 2: This is just a nicity, but it makes things a bit more general:
--- if we have an assumption `t1 ~ t2`, then we use the fact that if we know
--- `t1` we also know `t2` and the other way.
+-- XXX: Combine the two `oclose`s.
+
+{- An alternative implementation of `oclose` used in the "liberal" coverage
+condition. Differences:
+
+ 1. The empty set of variables is allowed to determine stuff,
+ 2. We also use equality predicates as FDs.
+
+ For 1:
+ This is needed because otherwise some valid instances are rejected.
+
+ For 2:
+ This is just a nicity, but it makes things a bit more general:
+ if we have an assumption `t1 ~ t2`, then we use the fact that if we know
+ `t1` we also know `t2` and the other way.
+-}
oclose1 :: [PredType] -> TyVarSet -> TyVarSet
oclose1 preds fixed_tvs
More information about the ghc-commits
mailing list