I recently wrote tomlcheck, which, as the name implies, is a syntax checker for TOML files. Since I'd read a call-to-arms regarding the lack of concrete success stories in Haskell a few months ago, I figured I'd contribute one of mine.
The Good
tomlcheck
was an easy success. If you don't believe me,
here's the language composition for my project, lovingly provided by
tokei.
Language | Files | Lines | Code | Comments | Blanks |
---|---|---|---|---|---|
Cabal | 1 | 77 | 60 | 1 | 6 |
Haskell | 3 | 44 | 32 | 4 | 8 |
YAML | 3 | 118 | 100 | 4 | 14 |
Total | 7 | 250 | 212 | 10 | 28 |
So it's only around 43 lines of Haskell, thanks to already available htoml
package and the oprparse-generic
package. I did admittedly rewrite
a bit of the htoml
package to use megaparsec
, plus I had to write some patches for bugs
which I may have introduced.
Megaparsec is really, really good. In addition to the fact that monadic parser
combinators are far better than what's available in most languages, its builtin error pretty printer generates
errors that vim can scan. This ended up being the primary reason I wrote
tomlcheck
in Haskell rather than Rust.
tomlcheck
's performance is superb, and I am eminently satisfied with Haskell
in this regard. Checking the largest file I could find in
real use (182 lines), it takes around 3.5 ms - basically instantaneous. It
feels different than yamllint.
The Bad
Haskell's CI situation is bad. There's not much exculpatory to be said here. I use trust for all my Rust builds and nothing Haskell has compares.
You can see this in the tokei
output too - there are around 120 lines of YAML
required to configure Travis and Appveyor.