This page provides an index of different resources about GHC plugins.
Blog posts
- Nicolas Frisby - 2019-05-26 - Notes for Authors of Type Checker Plugins
- waddlaw - 2018-12-01 - GHC Source Plugin 作ってみた
- Kenny Shen - 2018-10-31 - Source modifications via GHC API and ghc-exactprint
- Jason Shipman - 2018-10-13 - Subvert Your Type Checker Today!
- Gabe Dijkstra - 2018-10-11 - Write Your Own GHC Type Checker Plugins
- phadej - 2018-09-13 - Regular expressions of types
- mpickering - 2018-08-10 - Specifying how a plugin affects recompilation
- mpickering - 2018-08-09 - Reimplementing graphmod as a source plugin
- phadej - 2018-07-06 - Idiom brackets via source plugin
- mpickering - 2018-06-24 - Nix scaffolding for running Haskell plugins
- mpickering - 2018-06-11 - Source Plugins: Four ways to build a typechecked Haskell expression
- nboldi - 2018-04-14 - Proposal 0017: Source Plugins
- nomeata - 2018-02-02 - The magic “Just do it” type class
- Tweag I/O - 2017-09-22 - GHC compiler plugins in the wild: typing Java
- christiaanb - 2016-08-17 - Solving custom operations in KnownNat constraints
- christiaanb - 2016-08-10 - Solving GHC’s KnownNat constraints
- Adam Gundry - 2015-07-17 - A Typechecker Plugin for Units of Measure
- Eric Seidel - 2014-12-04 - (Ab)using Compiler Plugins to Improve Embedded DSLs
- Max Bolingbroke - Compiler Plugins For GHC 123456
- Max Bolingbroke - 2008-04-24 - The Summer Of Code, or Compiler Development for the Masses
Tutorial plugins
plugin-constraint- mpickeringHow to interact with the contraint solve and generate
HsExpr GhcTc.hashtag-coerce- mpickeringHow to perform a simple static analysis using
sybto traverse the syntax tree.ghc-typelits-gcd- christiaanbAn example of implementing a constraint solver plugin
Source plugins
hlint-source-plugin- ocharlesRuns
hlintduring compilation and reports errors are though they are GHC errors.assert-explainer- ocharlesInstruments an assertion to print the value of its failed parts when it fails.
what-it-do- ocharlesRewrites
doexpressions to trace all binds.smuggler- kowainikPlugin which removes unused imports automatically.
lift-plugin- mpickeringAn experimental plugin which introduces an operator which acts like an overloadable bracket.
graphmod-plugin- mpickeringA reimplementation of
graphmodas a source plugin.idioms-plugins- phadejImplementation of idiom brackets using a parser plugin.
kleene-type- phadejImplementation of a syntax for HLists and solver for a custom
MatchIconstraint which implements a custom type family for regular expressions.detect-unquantified-tyvars- Thomas WinantWarn about type variables which are not explitly quantified.
source-constraints- Markus SchirpEnforce invariants on the structure of programs. For example: that an import list is sorted.
record-dot-preprocessor- ndmitchellRecord dot syntax: Access record fields with
record.field.
Core plugins
dump-core- yavA pretty printer which renders HTML for GHC’s internal representation
HerbiePlugin- mikeizbickiGHC plugin that improves Haskell code’s numerical stability
sbvPlugin- LeventErkokProve properties about Haskell programs using SBV/SMT.
ghc-justdoit- nomeataPlugin which synthesises a definition from a type, like
djinn.inspection-testing- nomeataEmbed assertions about the intermediate code and have them checked by GHC.
ghc-srcspan-plugin- gridaphobeGeneric GHC Plugin for annotating Haskell code with source location data.
concat- conalA plugin which overloads Haskell programs so they can be interpreted in different ways.
unroll-plugin- Max BolingbrokeA plugin which unrolls loops based on user annotations.
Constraint solver plugins
uom-plugin- adamgundrySupport for solving constraints mentioning units of measure.
ghc-typelits-extra- christiaanbExtra type-level operations on
GHC.TypeLits.Nat, solved using a plugin.type-nat-solver- yavSolve numerical constants using an SMT solver
coxswain- nfrisbyA GHC type checker plugin for row types
thoralf- Divesh-OtwaniA plugin that solves constraints using Z3.