[GHC] #9980: TcS monad is too heavy

GHC ghc-devs at haskell.org
Tue Jan 13 14:04:09 UTC 2015


#9980: TcS monad is too heavy
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by simonpj:

Old description:

> The typehcecker's constraint-solving monad, `TcS`, is simply built on top
> of `TcM`, but it doesn't use most of `TcM`'s facilities.  That was fine
> while `TcS` was only called from the typechecker, but now (as part of
> [wiki:PatternMatchCheck fixing pattern-match overlap checking]) we invoke
> it from the desugarer.
>
> It seems quite wrong to construct a vast, and unnecessary `TcM` context
> just to invoke `TcS`.
>
> Better: make `TcS` into its own monad, with its own `TcSLclEnv`, built on
> `IOEnv` like the others.
>
> Main objection: the plugins mechanism exposes `unsafeTcPluginTcM`, which
> would become unavailable.  But it it used?

New description:

 The typechecker's constraint-solving monad, `TcS`, is simply built on top
 of `TcM`, but it doesn't use most of `TcM`'s facilities.  That was fine
 while `TcS` was only called from the typechecker, but now (as part of
 [wiki:PatternMatchCheck fixing pattern-match overlap checking]) we invoke
 it from the desugarer.

 It seems quite wrong to construct a vast, and unnecessary `TcM` context
 just to invoke `TcS`.

 Better: make `TcS` into its own monad, with its own `TcSLclEnv`, built on
 `IOEnv` like the others.

 Main objection: the plugins mechanism exposes `unsafeTcPluginTcM`, which
 would become unavailable.  But it it used?

--

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


More information about the ghc-tickets mailing list