Skip to content

TcS monad is too heavy

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 fixingpattern-matchoverlapchecking) 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?

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information