[GHC] #12749: Typechecker regression involving RankNTypes

GHC ghc-devs at haskell.org
Fri Oct 21 14:57:02 UTC 2016


#12749: Typechecker regression involving RankNTypes
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 It worked before due to a bug that makes type inference unpredictable.
 The issues it that the two branches of the `if` both have a higher rank
 type, and that is difficult.

 The solution here is to tell GHC the type of the conditional:
 {{{
 applyNTCheck :: NatTrans (Either a) Maybe
 applyNTCheck = ((if b then trans else applyNT)
                      :: NatTrans (Either a) Maybe
                      -> NatTrans (Either a) Maybe)
                 eitherToMaybe
 }}}
 Sorry!  If I knew how to do better I would.

 Simon

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


More information about the ghc-tickets mailing list