haskell-prettyprinter / haskell-prettyprinter/prettyprinter
`space`s not collapsed
- Dominant language
- Haskell
- Stars
- 309
- Forks
- 43
- Avg merge
- 21h 25m
- Merged PRs (30d)
- 1
Description
The following snippet
```haskell
putStrLn . renderString . layoutPretty defaultLayoutOptions $
pretty "a" <+> mempty <+> pretty "b"
```
gives this output:
```
a b
```
(two spaces between `a` and `b`). Most of the time I want spaces to collapse i.e. to have
```haskell
x <> space <> space === x <> space
```
because I often write things like `x <+> (if b then y else mempty) <+> z` and I want to have one space between `x` and `z` when `b` is `False`. _I think_, `pretty` (the library) works this way.
With the current behaviour I have to structure my pretty-printers in a weird non-compositional way. Is it maybe possible to add a `layoutCollapseSpaces :: Bool` option to `LayoutOptions`?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.