talira

haskell-src-exts

Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

open sourceBSD-3-Clausefree

haskell-src-exts (HSE) is a standalone Haskell library for parsing, building and pretty-printing Haskell source code. It descends from the haskell-src package but supports the syntactic extensions found in compilers and tools, such as multi-parameter type classes, functional dependencies, GADTs and Template Haskell, plus HaRP regular patterns and HSX embedded XML. Its modules give an abstract syntax tree, combinators for building syntax, a parser and a pretty-printer.

Problems it solves

  • parse Haskell source into a syntax tree for a linter or refactoring tool
  • generate Haskell code and pretty-print it
  • read Haskell files that use GHC extensions in my own tool

Features

  • a parser for Haskell source with GHC's syntactic extensions
  • an abstract syntax tree and combinators for building syntax
  • a pretty-printer
  • HaRP regular patterns and HSX embedded XML syntax

Limitations

  • Its maintainer keeps it on life support, and its README suggests ghc-lib-parser instead1