[GHC] #11457: Run type-checker plugins before GHC's solver

GHC ghc-devs at haskell.org
Tue Jan 19 02:08:26 UTC 2016


#11457: Run type-checker plugins before GHC's solver
-------------------------------------+-------------------------------------
        Reporter:  gridaphobe        |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:                    |             Keywords:  plugin
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 dfeuer):

 We need to intertwine the various aspects, and I don't know how that works
 with the plugin infrastructure. For example, if we have (hypothetically)

 {{{#!hs
 import Prelude.Extras
 {-# SuppressInstance Functor ((,) a) #-}

 foo :: (p -> q) -> Lift1 ((,) x) p -> Lift1 ((,) x) q
 foo = fmap
 }}}

 GHC will recognize a `Functor (Lift1 ((,) x))` constraint. We need the
 usual constraint solver to run far enough to determine that this requires
 `Functor ((,) x)` before we can step in and reject the solution.

 ----

 Note that the suppression regime has not yet gone far enough for a full-on
 proposal yet. Some things people might want:

 1. Suppress or warn about an instance unconditionally. This is clearly the
 simplest case, and covers the immediate demand.
 2. Suppress or warn about an instance if a certain constraint *can* be
 satisfied. This seems a bit shady, but it may have applications.
 3. Suppress or warn about use of an instance if a certain constraint
 *cannot* be satisfied. That is, add that constraint to the instance
 temporarily. This might be desirable if an instance is *implementable*
 without the given constraint, but doesn't really make *sense* without it.

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


More information about the ghc-tickets mailing list