[GHC] #14391: Make the simplifier independent of the typechecker

GHC ghc-devs at haskell.org
Tue Nov 7 22:14:26 UTC 2017


#14391: Make the simplifier independent of the typechecker
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:  newcomer
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):

 Great.

 I suggest you start with `TcEnv.lookupGlobal`.

 * It invokes `initTcForLookup` (massive overkill) in order to call
 `tcLookupGlobal`. We need  a versionn of this function that operates in
 the IO monad, not the `TcM` monad.

 * What does `tcLookupGlobal` get from the `TcM` monad?  It'll need to get
 these things as explicit arguments instead, I guess.  For example:
 consults the `tcg_type_env`, which was initialised by `initTcForLookup`.
 And it uses `tcg_semantic_mod` likewise.

 * Then it hands off to `LoadIface.tcLookupImported_maybe`.  That does a
 bit more IO-ish things before finally deciding to load a new interface
 decl in `tcImportDecl_maybe`.

 * `tcImportDecl_maybe` uses `initIfaceTcRn` to make an `IfM` moand in
 which to do the loading work.  But instesad you can make an `IfM` from
 scratch, by writing a variant of `initIfaceTcRn`.

 Nothing really hard here, but you'll need to carefully tease out what
 dependencies are where.  (The lack of explicit dependencies is, of course,
 both the blessing and the curse of monadic  progrmaming.)

 Happy to help.

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


More information about the ghc-tickets mailing list