[GHC] #9980: TcS monad is too heavy

GHC ghc-devs at haskell.org
Wed May 23 21:32:01 UTC 2018


#9980: TcS monad is too heavy
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.4
      Resolution:                    |             Keywords:
                                     |  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:                    |
-------------------------------------+-------------------------------------
Changes (by adamgundry):

 * cc: darchon, nfrisby (added)


Comment:

 I don't think `unsafeTcPluginTcM` should block this refactoring, provided
 we can provide `unsafeTcPluginTcS` and make sure that `TcS` is still
 sufficiently well-equipped. What "sufficiently well-equipped" means is a
 bit hard to pin down, but it should at least support the existing
 `TcPluginM` API.

 I think we should preserve the ability to do lookups in `TcPluginM`. For
 example, `ghc-typelits-knownnat` needs `mkNaturalExpr`, which relies on
 lookup (via `MonadThings`). I guess in that case one could copy code and
 refactor so as to do the lookups once, but in general I can imagine a
 plugin wanting to look up things that are not known at initialisation
 time. We should probably just make `TcPluginM` instantiate `MonadThings`.

 Perhaps Christiaan or Nick can comment on other use cases for
 `unsafeTcPluginTcM`?

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


More information about the ghc-tickets mailing list