prettyprint-avh4: API for prettyprinting custom syntax trees (extracted from elm-format)

[ bsd3, library, pretty-printer, text ] [ Propose Tags ] [ Report a vulnerability ]

This package provides an API for structured text layout, used by elm-format and gren for source code formatting.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0
Change log CHANGELOG.md
Dependencies base (>=4.9 && <5), bytestring (>=0.11.1.0 && <0.12) [details]
Tested with ghc ==9.2.5, ghc ==9.4.4
License BSD-3-Clause
Author Aaron VonderHaar
Maintainer gruen0aermel@gmail.com
Category Pretty Printer, Text
Home page https://codeberg.org/avh4/prettyprint-avh4
Bug tracker https://codeberg.org/avh4/prettyprint-avh4/issues
Source repo head: git clone https://codeberg.org/avh4/prettyprint-avh4.git
Uploaded by avh4 at 2023-04-15T06:02:07Z
Distributions NixOS:0.1.1.0
Downloads 217 total (18 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-04-15 [all 1 reports]

Readme for prettyprint-avh4-0.1.1.0

[back to package description]

This package provides an API for structured text layout, used by elm-format and gren for source code formatting.

Compared to other pretty-printing approaches, this library has the following characteristics:

  • Fitting to a maximum column width is not supported (and is considered an anti-feature)
  • The API has a design goal of making it easy to write text formatters for custom syntax trees
  • The API is meant primarily for use in bottom-up folds
  • ByteString.Builder is used as the underlying primitive type to optimize memory allocation (especially when writing to an output stream)

Future improvements

Contributions for the following are welcome:

  • Add benchmarks and/or improve performance
  • Improve documentation
  • Provide new use-cases for writing syntax tree formatters, and improve the API design

If there is some other existing Haskell library that fulfills the goals of this project, I'd be interested in deprecating this project in favor of the other.