trimdent: A utility for neat multiline string trimming

[ agpl, library, string ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/gregorias/trimdent#readme


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0
Dependencies base (>=4.13 && <5) [details]
License AGPL-3.0-only
Copyright Copyright (c) 2021 Grzegorz Milka
Author Grzegorz Milka
Maintainer grzegorzmilka@gmail.com
Category String
Home page https://github.com/gregorias/trimdent#readme
Bug tracker https://github.com/gregorias/trimdent/issues
Source repo head: git clone https://github.com/gregorias/trimdent
Uploaded by gregorias at 2021-07-28T09:19:42Z
Distributions LTSHaskell:0.1.0.0, NixOS:0.1.0.0, Stackage:0.1.0.0
Downloads 358 total (5 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-07-28 [all 1 reports]

Readme for trimdent-0.1.0.0

[back to package description]

trimdent

Trimdent is a simple library for smartly trimming and unindenting strings.

>>> import Text.RawString.QQ (r)
>>> trimdent [r|func add(x int, y int) int {
                  return x + y
                }
             |]
"func add(x int, y int) int {\n\
\  return x + y\n\
\}"

Why is this useful?

This library is useful when you are writing your own quasi quoter and want to sanitize whitespace.

How does it compare to other libraries?

  • Neat-interpolation exposes the same functionality but only in an interpolating quasi quoter. This means that you can't easily use it in your own quoters.
  • raw-strings-qq gives quasi quoters to express multi-line strings, but they don't do any trimming.