[GHC] #15248: Coercions from plugins cannot be stopped from floating out

GHC ghc-devs at haskell.org
Fri Jun 8 14:07:51 UTC 2018


#15248: Coercions from plugins cannot be stopped from floating out
-------------------------------------+-------------------------------------
           Reporter:  goldfire       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Suppose we have

 {{{#!hs
 type family (a :: Nat) <? (b :: Nat) :: Bool
 }}}

 that computes whether `a` is less than `b`, where a type checker plugin
 does the proof work. For some `a`, `b`, and `c`, if we assume `(a <? b) ~
 True` and `(b <? c) ~ True`, the plugin can prove `(a <? c) ~ True`.
 However, GHC currently provides no way for the plugin to indicate that the
 proof of `(a <? c) ~ True` depends on the assumptions. This means that the
 plugin-produced proof evidence could potentially float out of its desired
 context, inviting disaster.

 In term of `Coercion`s, I propose that the `PluginProv` constructor of
 `UnivCoProvenance` be allowed to include a `TyCoVarSet` of "free
 variables" (that is, assumptions) in the proof. Computing the free
 variables of the enclosing `UnivCo` would returns these variables, too. It
 is, of course, up to the plugin to provide the right information here, but
 plugins generally have enough information to do this correctly (or, at
 least, to conservatively list all free variables of assumptions as free
 variables of the conclusion).

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


More information about the ghc-tickets mailing list