[GHC] #11339: Possible type-checker regression in GHC 8.0

GHC ghc-devs at haskell.org
Fri Oct 21 16:16:17 UTC 2016


#11339: Possible type-checker regression in GHC 8.0
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:  simonpj
            Type:  bug               |               Status:  closed
        Priority:  highest           |            Milestone:  8.0.2
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  typecheck/should_compile/T11339,
                                     |  T11339b, T11339c, T11339d; partial-
                                     |  sigs/should_compile/T11339a
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"45bfd1a65978ee282d8d2cc1ddb7e3e5f4cd4717/ghc" 45bfd1a/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="45bfd1a65978ee282d8d2cc1ddb7e3e5f4cd4717"
 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!
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11339#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list