[GHC] #14709: Extend the plugin mechanism to access program representation

GHC ghc-devs at haskell.org
Mon Jan 29 01:49:34 UTC 2018


#14709: Extend the plugin mechanism to access program representation
-------------------------------------+-------------------------------------
        Reporter:  lazac             |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHC API           |              Version:  8.2.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:                    |  https://phabricator.haskell.org/D4342
  https://ghc.haskell.org/trac/ghc/wiki/ExtendedPluginsProposal|
-------------------------------------+-------------------------------------

Comment (by lazac):

 Replying to [comment:5 bgamari]:
 > Writing down a few motivating examples of applications of the new plugin
 types may be a good place to start.

 Some of these tools exist using external libraries, but by using GHC as
 the backend they may be applied to more complex projects. I'm mostly
 interested in editing and code transformation tools, so here is a few
 example:

  - **Auto-complete**: Records the names available in a scope using
 interface files and type checked AST.
  - **Semantics aware formatting**: Auto-formatter that uses fixity
 information to break up complex operator expressions. Uses parsed and type
 checked representation.
  - **Semantics aware syntax highlight**: Check interfaces for recording
 extra information about names and use this in an editor to enhance
 highlighting names.
  - **Code generator**: Generating pattern matches and expressions in a
 dependent-typed fashion.
  - **Auto-correct**: Automatic fix common errors. Uses `-fdefer-*` flags,
 extracts type-checked representation. Also checks interfaces files.
  - **Refactoring tool**: Building a project database of syntactic and
 semantic information to rewrite source code. Uses all versions of syntax
 tree, splices, interfaces.

 My suggestion for recompilation checking is:
   - `-fplugin` change -> recompile
   - The hash of used plugin changes -> recompile
   - `-fplugin-opt` change -> ask the plugin for each module whether
 recompilation is needed

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14709#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list