[GHC] #11301: Using GHC's parser and rendering the results is unreasonably difficult
GHC
ghc-devs at haskell.org
Mon Dec 28 05:58:22 UTC 2015
#11301: Using GHC's parser and rendering the results is unreasonably difficult
-------------------------------------+-------------------------------------
Reporter: bitemyapp | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHC API | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by bitemyapp):
>Willing to improve it, but it's very unclear what a good interface is
supposed to be.
This is good:
http://hackage.haskell.org/package/haskell-src-exts-1.17.1/docs/Language-
Haskell-Exts-Parser.html#v:parseExp
The code you posted is going to send new people running for the hills (or
Rust. or OCaml). There's no documentation, no way of knowing why one would
want a frontend plugin or what problem it is solving for us. Googling the
error message I got earlier was quite fruitless too.
We don't really have to spend a lot of time discussing the API. Just
catching up the GHC API's UX to the standard set by haskell-src-exts is
sufficient for my purposes. Is there a reason a parser of Haskell source
code needs to emit IO? If not, then there should be types like this
available:
{{{#!hs
parseExp :: String -> ParseResult Exp
}}}
even if there are nittier-grittier underlying functions/facilities
available.
Further, why doesn't `ParseResult` in the GHC API have a Show instance?
Trying to figure out something simple like, "parse this expression from a
string and print the parse tree to stdout", with GHC's API is way-way-way
harder than it should be and adding "more stuff" that the user has to
know-about, care-about, etc. isn't good enough.
It also looks like this frontend plugin thing doesn't work for REPL use.
This is also not satisfactory.
I'm assuming there are serious, difficult technical reasons the API
provided by GHC doesn't include a simple "just parse the damn string"
function with a Showable ParseResult. Could someone please explain those
reasons?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11301#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list