[GHC] #15147: Type checker plugin receives Wanteds that are not completely unflattened

GHC ghc-devs at haskell.org
Tue Jun 12 20:48:21 UTC 2018


#15147: Type checker plugin receives Wanteds that are not completely unflattened
-------------------------------------+-------------------------------------
        Reporter:  nfrisby           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler (Type    |              Version:  8.4.1
  checker)                           |             Keywords:
      Resolution:                    |  TypeCheckerPlugins
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 simonpj):

 >  if I a programmer wrote x ~ F a, G x ~ G Int, then would un-flattening
 rewrite this to G (F a) ~ G Int or would it leave it as is?

 If these were Wanteds, un-flattening would not rewrite to `G (F a) ~ G
 Int`.  (Wanteds do not rewrite Wanteds.)  But if they were Givens, which
 we don't un-unflatten, we'd end up with
 {{{
 [G] F a ~ fsk1     CFunEqCan
 [G] G fsk1 ~ fsk2  CFunEqCan
 [G] G Int ~ fsk3   CFunEqCan
 [G] fsk2 ~ fsk3    CTyEqCan
 [G] x ~ fsk1       CTyEqCan
 }}}
 If we didn't unflatten Wanteds either, we'd get
 {{{
 [W] F a ~ fuv1     CFunEqCan
 [W] G x ~ fuv2     CFunEqCan    -- NB: not rewritten by [W] x~fuv1
 [W] G Int ~ fsk3   CFunEqCan
 [W] x ~ fuv1       CTyEqCan
 [W] fuv2 ~ fuv3    CTyEqCan
 }}}

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


More information about the ghc-tickets mailing list