[GHC] #10961: Make it possible to purely use the parser

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Keywords: newcomer | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It is claimed that the parser is pure but one of the arguments is `DynFlags`. The only safe way to construct a copy of `DynFlags` requires IO so it is not possible to use the parser purely. I propose to introduce a new datatype `ParserOptions` which contains the options used by the parser and a function `DynFlags -> ParserOptions` so that it is possible to purely construct a `ParserOptions` and use the parser purely. This would be useful for external users of the parser. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * related: => #10143 Comment: #10143 also wants to split out a part of DynFlags. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dalaing): This looks like it might be pretty intimately related to #10143, since in Lexer.x we have uses of `mkWarnMsg`, which in turn use `showSDoc`, which requires `DynFlags`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): Makes sense. I didn't do much investigation about what needed to be pulled out. However, I think #10143 would be quite a bit more involved because SDocs are everywhere in the compiler. Make sure to post here what you discover even if you don't make much progress. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dalaing): I'm now wondering if it would make sense to have the parser track some kind of warning-related values rather than convert them to SDocs, at least during the pure part. If the conversion to SDocs can be done after the parsing, that means users of the pure parsing interface have less structures to set up before they can do things. The alternative would be to further split up the pretty printing flags, so that the things needed for printing error handling are easily available (and potentially a default value can be exposed for ease of use). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: dalaing Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dalaing): * owner: => dalaing -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: dalaing Type: task | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): D2208 Wiki Page: | -------------------------------------+------------------------------------- Changes (by dalaing): * status: new => patch * differential: => D2208 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: dalaing Type: task | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): D2208 Wiki Page: | -------------------------------------+------------------------------------- Comment (by dalaing): I've dealt with the pretty printing of warnings by changing from `messages :: Messages` to `messages :: DynFlags -> Messages` in `PState`. This also means there are some changes to pass in `DynFlags` when `getMessages` is called. This would change back if a resolution of #10143 meant we could pretty print warnings without needing `DynFlags`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10961: Make it possible to purely use the parser
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner: dalaing
Type: task | Status: patch
Priority: low | Milestone:
Component: Compiler | Version: 7.10.2
(Parser) |
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #10143 | Differential Rev(s): D2208
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10961: Make it possible to purely use the parser -------------------------------------+------------------------------------- Reporter: mpickering | Owner: dalaing Type: task | Status: closed Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10143 | Differential Rev(s): Phab:D2208 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * status: patch => closed * differential: D2208 => Phab:D2208 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10961#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC