syntax: Syntax descriptions for unified parsing and pretty-printing.

[ data, library, mit ] [ Propose Tags ]

syntax allows you to write a single syntax description and instantiate is both as a parser and a pretty printer.

The interface is based on a custom Functor/Applicative/Monad hierarchy, provided by the semi-iso package. You fmap using a semi-isomorphism instead of function. A semi-isomorphism is a isomorphism that can fail in both directions, with slightly weakened laws. It is worth to note that Isos and Prisms from lens are valid semi-isomorphisms :)

Once you write a description you can, for example turn it into an Attoparsec parser, or into a Data.Syntax.Printer.Text.Printer.

See syntax-example and syntax-example-json for examples, syntax-attoparsec and syntax-printer for a parser/printer implementation.

The library was inspired by:


Versions [faq],,,,,
Dependencies base (==4.*), lens (>=4), mono-traversable, scientific (>=0.3), semi-iso (>=0.5.0), text [details]
License MIT
Copyright Paweł Nowak 2014
Author Paweł Nowak
Maintainer Paweł Nowak <>
Category Data
Source repo head: git clone
Uploaded by pawel834 at Sun Nov 30 16:01:18 UTC 2014
Distributions NixOS:
Downloads 2926 total (53 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]




Maintainer's Corner

For package maintainers and hackage trustees