haskell-prettyprinter / haskell-prettyprinter/prettyprinter
Improving correctness
- Dominant language
- Haskell
- Stars
- 309
- Forks
- 43
- Avg merge
- 21h 25m
- Merged PRs (30d)
- 1
Description
I'm quite impressed by (and a bit proud of!) the number of bugs that has been revealed through `dhall`'s usage of `prettyprinter`!
I wonder how `prettyprinter` could rely less on the users to discover these bugs though.
In particular I wonder whether property tests could help – IMHO they've been quite effective in [`dhall`](https://github.com/dhall-lang/dhall-haskell/blob/e931451a2b2892fa373c9dfc94b31bcd764131be/dhall/tests/Dhall/Test/QuickCheck.hs#L496-L547)!
For example I believe that the recent bugs could have been discovered by tests for the following properties:
* https://github.com/quchen/prettyprinter/issues/91: The result of applying `layout{Pretty,Smart} opts . group` to a `Doc` that doesn't contain `Fail`, should never contain `SFail`.
* For `removeTrailingWhitespace`:
* The (rendered) input and output should only differ by trailing spaces.
* The output should never contain trailing spaces.
* `removeTrailingWhitespace` is idempotent.
It's probably more difficult to come up with properties that would reveal unknown bugs, but it might be worth trying!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.