[GHC] #13804: MonoLocalBinds/RankNTypes type inference regression in GHC 8.2

GHC ghc-devs at haskell.org
Fri Jun 16 21:20:38 UTC 2017


#13804: MonoLocalBinds/RankNTypes type inference regression in GHC 8.2
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.1-rc2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11698            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

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

 In [changeset:"dc8e6861dc5586a8222484afc3bd26c432e2d69c/ghc"
 dc8e6861/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="dc8e6861dc5586a8222484afc3bd26c432e2d69c"
 Fix the treatment of 'closed' definitions

 The IdBindingInfo field of ATcId serves two purposes

 - to control generalisation when we have -XMonoLocalBinds
 - to check for floatability when dealing with (static e)

 These are related, but not the same, and they'd becomme confused.
 Trac #13804 showed this up via an example like this:

   f periph = let sr :: forall a. [a] -> [a]
                  sr = if periph then reverse else id

                  sr2 = sr
                  -- The question: is sr2 generalised?
                  -- It should be, because sr has a type sig
                  -- even though it has periph free
              in
              (sr2 [True], sr2 "c")

 Here sr2 should be generalised, despite the free var 'periph'
 in 'sr' because 'sr' has a closed type signature.

 I documented all this very carefully this time, in TcRnTypes:
   Note [Meaning of IdBindingInfo]
   Note [Bindings with closed types: ClosedTypeId]
 }}}

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


More information about the ghc-tickets mailing list