Refactor GHCi UI to fix #11606, #12091, #15721, #16096

Merged Ömer Sinan Ağacan requested to merge osa1/ghc:wip/T16096 into master

Instead of parsing and executing a statement or declaration directly we now parse them first and then execute in a separate step. This gives us the flexibility to inspect the parsed declaration before execution. Using this we now inspect parsed declarations, and if it's a single declaration of form x = y we execute it as let x = y instead, fixing a ton of problems caused by poor declaration support in GHCi.

To avoid any users of the modules I left execStmt and runDecls unchanged and added execStmt' and runDecls' which work on parsed statements/declarations.

Edited by Ömer Sinan Ağacan

Merge request reports