[commit: ghc] wip/spj-tc-branch2: Refactor typechecking of pattern bindings (19140fd)
git at git.haskell.org
git at git.haskell.org
Fri Sep 30 15:17:38 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/spj-tc-branch2
Link : http://ghc.haskell.org/trac/ghc/changeset/19140fd5d178e7522ea9e939221686b1fd4c4a83/ghc
>---------------------------------------------------------------
commit 19140fd5d178e7522ea9e939221686b1fd4c4a83
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Aug 31 09:28:39 2016 +0100
Refactor typechecking of pattern bindings
This patch fixes a regression introduced, post 8.0.1, by
this major commit:
commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Sat Jun 11 23:49:27 2016 +0100
Improve typechecking of let-bindings
This major commit was initially triggered by #11339, but it
spiraled into a major review of the way in which type
signatures for bindings are handled, especially partial type
signatures.
I didn't get the typechecking of pattern bindings right, leading
to Trac #12427.
In fixing this I found that this program doesn't work:
data T where
T :: a -> ((forall b. [b]->[b]) -> Int) -> T
h1 y = case y of T _ v -> v
Works in 7.10, but not in 8.0.1.
There's a happy ending. I found a way to fix this, and improve
pattern bindings too. Not only does this fix #12427, but it also
allows
In particular,we now can accept
data T where MkT :: a -> Int -> T
... let { MkT _ q = t } in ...
Previously this elicited "my head exploded" but it's really
fine since q::Int.
The approach is described in detail in TcBinds
Note [Typechecking pattern bindings]
Super cool. And not even a big patch!
>---------------------------------------------------------------
19140fd5d178e7522ea9e939221686b1fd4c4a83
compiler/typecheck/TcBinds.hs | 226 +++++++++++++--------
compiler/typecheck/TcPat.hs | 193 ++++++++++--------
.../tests/typecheck/should_compile/T12427a.hs | 40 ++++
.../tests/typecheck/should_compile/T12427b.hs | 20 ++
testsuite/tests/typecheck/should_compile/all.T | 2 +
5 files changed, 304 insertions(+), 177 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 19140fd5d178e7522ea9e939221686b1fd4c4a83
More information about the ghc-commits
mailing list