This page provides an index of different resources about GHC plugins.

Blog posts

Tutorial plugins

plugin-constraint- mpickering

How to interact with the contraint solve and generate HsExpr GhcTc.

hashtag-coerce - mpickering

How to perform a simple static analysis using syb to traverse the syntax tree.

ghc-typelits-gcd - christiaanb

An example of implementing a constraint solver plugin

Source plugins

hlint-source-plugin- ocharles

Runs hlint during compilation and reports errors are though they are GHC errors.

assert-explainer - ocharles

Instruments an assertion to print the value of its failed parts when it fails.

what-it-do - ocharles

Rewrites do expressions to trace all binds.

smuggler - kowainik

Plugin which removes unused imports automatically.

lift-plugin - mpickering

An experimental plugin which introduces an operator which acts like an overloadable bracket.

graphmod-plugin - mpickering

A reimplementation of graphmod as a source plugin.

idioms-plugins - phadej

Implementation of idiom brackets using a parser plugin.

kleene-type - phadej

Implementation of a syntax for HLists and solver for a custom MatchI constraint which implements a custom type family for regular expressions.

detect-unquantified-tyvars- Thomas Winant

Warn about type variables which are not explitly quantified.

source-constraints - Markus Schirp

Enforce invariants on the structure of programs. For example: that an import list is sorted.

record-dot-preprocessor - ndmitchell

Record dot syntax: Access record fields with record.field.

Core plugins

dump-core - yav

A pretty printer which renders HTML for GHC’s internal representation

HerbiePlugin - mikeizbicki

GHC plugin that improves Haskell code’s numerical stability

sbvPlugin - LeventErkok

Prove properties about Haskell programs using SBV/SMT.

ghc-justdoit - nomeata

Plugin which synthesises a definition from a type, like djinn.

inspection-testing - nomeata

Embed assertions about the intermediate code and have them checked by GHC.

ghc-srcspan-plugin - gridaphobe

Generic GHC Plugin for annotating Haskell code with source location data.

concat - conal

A plugin which overloads Haskell programs so they can be interpreted in different ways.

unroll-plugin - Max Bolingbroke

A plugin which unrolls loops based on user annotations.

Constraint solver plugins

uom-plugin - adamgundry

Support for solving constraints mentioning units of measure.

ghc-typelits-extra - christiaanb

Extra type-level operations on GHC.TypeLits.Nat, solved using a plugin.

type-nat-solver - yav

Solve numerical constants using an SMT solver

coxswain - nfrisby

A GHC type checker plugin for row types

thoralf - Divesh-Otwani

A plugin that solves constraints using Z3.