[commit: ghc] master: Bring Note in TcDeriv up to date (e4cf962)
git at git.haskell.org
git at git.haskell.org
Wed Oct 5 20:15:54 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/e4cf962385924004b1ca0e39566222661bdde51f/ghc
>---------------------------------------------------------------
commit e4cf962385924004b1ca0e39566222661bdde51f
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Wed Oct 5 16:13:29 2016 -0400
Bring Note in TcDeriv up to date
Comments only.
[ci skip]
>---------------------------------------------------------------
e4cf962385924004b1ca0e39566222661bdde51f
compiler/typecheck/TcDeriv.hs | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index 3fcc80d..c5c8387 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -712,6 +712,10 @@ deriveTyData tvs tc tc_args deriv_strat deriv_pred
-- do not mention any of the dropped type variables
-- newtype T a s = ... deriving( ST s )
-- newtype instance K a a = ... deriving( Monad )
+ --
+ -- It is vital that the implementation of allDistinctTyVars
+ -- expand any type synonyms.
+ -- See Note [Eta-reducing type synonyms]
; spec <- mkEqnHelp Nothing tkvs
cls final_cls_tys tc final_tc_args
@@ -885,17 +889,8 @@ the eta-reduced type variables are mentioned elsewhere in the declaration. But
we need to be careful, because if we don't expand through the Const type
synonym, we will mistakenly believe that f is an eta-reduced type variable and
fail to derive Functor, even though the code above is correct (see Trac #11416,
-where this was first noticed).
-
-For this reason, we call exactTyCoVarsOfTypes on the eta-reduced types so that
-we only consider the type variables that remain after expanding through type
-synonyms.
-
- -- Use exactTyCoVarsOfTypes, not tyCoVarsOfTypes, so that we
- -- don't mistakenly grab a type variable mentioned in a type
- -- synonym that drops it.
- -- See Note [Eta-reducing type synonyms].
- dropped_tvs = exactTyCoVarsOfTypes args_to_drop
+where this was first noticed). For this reason, we expand the type synonyms in
+the eta-reduced types before doing any analysis.
-}
mkEqnHelp :: Maybe OverlapMode
More information about the ghc-commits
mailing list