[GHC] #9804: Layering: Suspicious dependency from Parser to TcEvidence

#9804: Layering: Suspicious dependency from Parser to TcEvidence -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- There is an import from Parser to TcEvidence module. Why does the parser need to know about type checking? The parser should produce an AST and through the AST (and global modules) be isolated from the rest of the compiler pipeline. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9804 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9804: Layering: Suspicious dependency from Parser to TcEvidence -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rodlogic): Along the same lines, why does HsSyn modules needs to import TcEvidence? The AST is a common currency across the pipeline and should be isolated as much as possible from the rest. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9804#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9804: Layering: Suspicious dependency from Parser to TcEvidence -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => invalid Comment: Fair point, but there is a good reason for this. The same `HsSyn` syntax tree is used for * The output of the parser * The output of the renamer * The output of the typechecker The latter, in particular, decorates the tree with information generated by the typechecker; the data types for much of that information is in `TcEvidence`. There are alternatives, of course. Eg have three data types not one; or use more aggressive parameterisation. But the cure seems worse than the disease. By all means suggest improvements, but I'll close this for now as "by design". Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9804#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9804: Layering: Suspicious dependency from Parser to TcEvidence -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rodlogic): I see. Considering that the typechecker (and possibly the parser and renamer) augment the HsSyn syntax tree, there is another option that is not as invasive as the ones you mentioned above: separate these typechecker decorators into a minimal, lower-level 'TcSyn' module or package. At least HsSyn modules can import these decorators without risks. Maybe these dependencies are already carefully layered this way? Even if they are, the current folder layout gives no indication of this layering and cycles are bound to be introduced over time by unsuspecting contributors. I raised this issue motivated by the experience of trying to run the parser/lexer in isolation (granted, for reasons unrelated to the type checker) and suddenly having to compile hundreds of modules when conceptually parser and lexer should be fairly lower-level components (I am new to the code base so there is also a good chance that part of this is my own ignorance). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9804#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9804: Layering: Suspicious dependency from Parser to TcEvidence -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): Well `TcEvidence` is the `TcSyn` you seek. If you have a concrete suggestion for how to improve, do by all means suggest it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9804#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC