[commit: ghc] wip/ghc-8.0-det: Refactor free tyvars on LHS of rules (ae94a31)
git at git.haskell.org
git at git.haskell.org
Mon Jul 25 14:58:46 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ghc-8.0-det
Link : http://ghc.haskell.org/trac/ghc/changeset/ae94a31e7f162b4a3ef6b6f837bd6006a98f639a/ghc
>---------------------------------------------------------------
commit ae94a31e7f162b4a3ef6b6f837bd6006a98f639a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Apr 22 10:47:14 2016 +0100
Refactor free tyvars on LHS of rules
A RULE can have unbound meta-tyvars on the LHS. Consider
data T a = C
foo :: T a -> Int
foo C = 1
{-# RULES "myrule" foo C = 1 #-}
After type checking the LHS becomes (foo alpha (C alpah)) and we do
not want to zap the unbound meta-tyvar 'alpha' to Any, because that
limits the applicability of the rule. Instead, we want to quantify
over it!
Previously there was a rather clunky implementation of this
quantification, buried in the zonker in TcHsSyn (zonkTvCollecting).
This patch refactors it so that the zonker just turns the meta-tyvar
into a skolem, and the desugarer adds the quantification. See DsBinds
Note [Free tyvars on rule LHS]. As it happened, the desugarer was
already doing something similar for dictionaries. See DsBinds
Note [Free dictionaries on rule LHS]
No change in functionality, but less cruft.
(cherry picked from commit 6ad2b42f866fa718855cc5c850e3549bc1428b3c)
>---------------------------------------------------------------
ae94a31e7f162b4a3ef6b6f837bd6006a98f639a
compiler/deSugar/DsBinds.hs | 99 +++++++++++++++++++------------
compiler/typecheck/TcHsSyn.hs | 134 ++++++++++++++++++------------------------
2 files changed, 121 insertions(+), 112 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ae94a31e7f162b4a3ef6b6f837bd6006a98f639a
More information about the ghc-commits
mailing list