For the longest time, PureScript did not have a formatter. There are a number of reasons:
PureScriptis written in Haskell, people are less likely to contribute since Haskell is still different from PureScript (even if they share similarities).
PureScriptwould be written in PureScript. Unfortunately, if
PureScriptwas self-hosted, runtime performance of the
pursbinary would suffer greatly otherwise. See purescript/purescript-in-purescript, which was stopped after that realization was made.
- Realistically, a formatter could be written in Haskell and reuse the PureScript language's parser. However, then less people would contribute as not everyone is familiar with Haskell
- If a formatter was written in PureScript, it would get more contributions.However, it would have to reimplement the PureScript language's parser and stay in sync with any changes made to the language. Moreover, it would likely be slower than writing it in a lower-level language (e.g. Haskell).
- Writing a formatter is very hard to do. It's typically a feat not done by your beginner or everyday programmer.
- Once written, maintainers can burn out because many individuals will want configuration added (e.g. "it should indent A in situation Y exactly N spaces but only M spaces in situation Z"). If the configuration is not added, people complain. If it is added, others might later complain about how it has TOO much configuration. Either way, it's typically the maintainer who adds the feature and those who want it don't contribute.
The first formatter written was
purty. This formatter was written in Haskell. It was the only formatter for a number of years. Some in the community chose to use it while others did not.
Around March/April 2021,
@natefaubion wrote a PureScript implementation of the PureScript language's parser: natefaubion/purescript-language-cst-parser.
The second and third formatters,
pose, respectively, were announced around the same time in August 2021. Both projects were under developement without knowing about each other.
purs-tidy is a standalone formatter whereas
pose is a plugin for the
|PureScript||Tiny announcement: yet another PureScript formatter|
|Haskell||Purty 1.0.0 released|