Extracting representation from GHC
Simon Peyton Jones
simonpj at microsoft.com
Fri Jan 19 17:27:44 UTC 2018
| To do this, my idea is to instruct GHC with a compilation flag to give
| out its internal representation of the source code.
Why can't you just use GHC as a library, and ask it to parse and typecheck the module and then look at what it gives you.
Others are more used to the GHC API than me, though.
S
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of
| Németh Boldizsár
| Sent: 19 January 2018 09:35
| To: ghc-devs at haskell.org
| Subject: Extracting representation from GHC
|
| Dear GHC Developers,
|
| I would like to ask your opinion on my ideas to make it easier to use
| development tools with GHC.
|
| In the past when working on a Haskell refactoring tool I relied on
| using the GHC API for parsing and type checking Haskell sources. I
| extracted the representation and performed analysis and transformation
| on it as it was needed. However using the refactorer would be easier
| if it could work with build tools.
|
| To do this, my idea is to instruct GHC with a compilation flag to give
| out its internal representation of the source code. Most build tools
| let the user to configure the GHC flags so the refactoring tool would
| be usable in any build infrastructure. I'm thinking of using the pre-
| existing plugin architecture and adding two new fields to the Plugin
| datastructure. One would be called with the parsed representation
| (HsParsedModule) when parsing succeeds, another with the result of the
| type checking (TcGblEnv) when type checking is finished.
|
| What do you think about this solution?
|
| Boldizsár
|
| (ps: My first idea was using frontend plugins, but I could not access
| the representation from there and --frontend flag changed GHC
| compilation mode.)
|
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h
| askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
| devs&data=02%7C01%7Csimonpj%40microsoft.com%7C9d78fd2d16994ade4d9008d5
| 5f2007c3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6365195135360471
| 87&sdata=voUEz%2BKTp0p3CtwP1Hx6xA3cXN0qoYONLPd9T7xRve8%3D&reserved=0
More information about the ghc-devs
mailing list