[GHC] #14419: Check kinds for ambiguity

GHC ghc-devs at haskell.org
Fri May 25 09:23:00 UTC 2018


#14419: Check kinds for ambiguity
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Simon, is this the one-line change you had in mind?

 {{{#!diff
 diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs
 index 7b27dfa..30023b9 100644
 --- a/compiler/typecheck/Inst.hs
 +++ b/compiler/typecheck/Inst.hs
 @@ -227,7 +227,7 @@ top_instantiate inst_all orig ty
      (theta, rho)   = tcSplitPhiTy phi

      should_inst bndr
 -      | inst_all  = True
 +      | inst_all  = binderArgFlag bndr /= Required
        | otherwise = binderArgFlag bndr == Inferred

  deeplyInstantiate :: CtOrigin -> TcSigmaType -> TcM (HsWrapper,
 TcRhoType)
 }}}

 Unfortunately, that causes `tc_sub_type_ds` to loop on `type family T2`
 from comment:4. The `-ddump-tc-trace` output loops on:

 {{{
 tc_sub_type_ds
   ty_actual   = forall (x :: a_a1zH[tau:1]) -> F x
   ty_expected = F x_a1zG[sk:1]
 Instantiating
   all tyvars? True
   origin arising from a type equality forall a. forall (x :: a) ->
                                       F x
                                       ~
                                       forall a. forall (x :: a) -> F x
   type forall x_a1za. F x_a1za
   theta []
   leave_bndrs [x_a1za]
   with
   theta: []
 tc_sub_type_ds
   ty_actual   = forall (x :: a_a1zH[tau:1]) -> F x
   ty_expected = F x_a1zG[sk:1]
 ...
 }}}

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


More information about the ghc-tickets mailing list