Just a real quick announcement: I’ve created a new CSV decoding library with a familiar API (shaped roughly like
elm/json) so that decoding is as boring as possible and you can get on with your app. Source, docs.
It incorporates some of the opinions I’ve formed about decoders over the years:
mapNis good for tuples, but records should prefer to use pipeline-style decoding early, so we have
- It should be easy to lift from a
String -> Result String ato a
Decoder a, so we have
Real quick, why? I see two problems with the tooling we have available:
- You have to select different packages to parse and decode, and there are quite a few options available for both. Compare with
elm/json, which does the whole thing in one step. This is my attempt to provide something that does that, which hopefully can save folks some time deciding which parser/decoder package pair to use.
- Improbably, none of the current packages implement
andThenat the decoder level. I needed that, so I decided to try and fix this problem #1 at the same time.
I know this means we now have 9 packages instead of 8 for CSV parsing (cf. XKCD 927), but I hope you’ll give it a try.