# Announcing brianhicks/elm-csv: a boring CSV decoder

**URL:** <https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797>\
**Category:** Show and Tell\
**Created:** [January 22, 2021, 4:01pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797 "2021-01-22T16:01:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/brian/32/2180_2.png) [@brian](https://discourse.elm-lang.org/u/brian)\
**Post date:** [January 22, 2021, 4:01pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/1 "2021-01-22T16:01:12Z")

</div>

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](https://github.com/BrianHicks/elm-csv), [docs](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/).

It incorporates some of the opinions I’ve formed about decoders over the years:

- `mapN` is good for tuples, but records should prefer to use pipeline-style decoding early, so we have [`map`](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/Csv-Decode#map), [`map2`](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/Csv-Decode#map2), [`map3`](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/Csv-Decode#map3), [`pipeline`](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/Csv-Decode#pipeline), and [`required`](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/Csv-Decode#required).
- It should be easy to lift from a `String -> Result String a` to a `Decoder a`, so we have [`fromResult`](https://package.elm-lang.org/packages/BrianHicks/elm-csv/latest/Csv-Decode#fromResult).

Real quick, **why?** I see two problems with the tooling we have available:

1. 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.
2. Improbably, none of the current packages implement `andThen` at 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](https://xkcd.com/927/)), but I hope you’ll give it a try.

---

<div class="post-metadata">

**Author:** ![andrewMacmurray](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/andrewmacmurray/32/2797_2.png) [@andrewMacmurray](https://discourse.elm-lang.org/u/andrewMacmurray)\
**Post date:** [January 22, 2021, 10:34pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/2 "2021-01-22T22:34:47Z")

</div>

Hooray! 🎉 Thanks Brian, this is just what we needed for an upcoming feature on our project

---

<div class="post-metadata">

**Author:** ![brian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/brian/32/2180_2.png) [@brian](https://discourse.elm-lang.org/u/brian)\
**Post date:** [January 22, 2021, 10:37pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/3 "2021-01-22T22:37:57Z")

</div>

excellent! Please let me know how it goes!

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [January 22, 2021, 11:11pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/4 "2021-01-22T23:11:22Z")

</div>

My one previous experience with CSV decoding in Elm was with:

“ericgj/elm-csv-decode”: “2.0.1”

Which is incredibly slow, and I never understood why. Was just a little tool to POST up some test data to a server, so it didn’t matter too much.

Good to see some boring alternatives. 🙃

---

<div class="post-metadata">

**Author:** ![brian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/brian/32/2180_2.png) [@brian](https://discourse.elm-lang.org/u/brian)\
**Post date:** [January 26, 2021, 9:11pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/5 "2021-01-26T21:11:39Z")

</div>

I just released version 2.0.0, which speeds up the parser by ~25x and shuffles some of the public API around.

> **[Release 2.0.0 –&nbsp;API improvements and faster parser · BrianHicks/elm-csv](https://github.com/BrianHicks/elm-csv/releases/tag/2.0.0)**
>
> es/tag/2.0.0

---

<div class="post-metadata">

**Author:** ![edkelly303](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/edkelly303/32/1510_2.png) [@edkelly303](https://discourse.elm-lang.org/u/edkelly303)\
**Post date:** [January 27, 2021, 10:39am UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/6 "2021-01-27T10:39:42Z")

</div>

This looks awesome!

Do you have any thoughts on whether it would be a good idea to include some CSV encoder functions too?

I’ve been using `commonmind/elm-csv-encode`, but it would be arguably be _even more_ boring to have both in one package, like `elm-json`, so you don’t even have to think about what combination of packages to use.

---

<div class="post-metadata">

**Author:** ![brian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/brian/32/2180_2.png) [@brian](https://discourse.elm-lang.org/u/brian)\
**Post date:** [January 27, 2021, 11:19am UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/7 "2021-01-27T11:19:58Z")

</div>

Yes, I’d love for there to be an encoding API! I released this version because I need it to solve another problem I’m working on. In fact, the FAQ says it might even be before 2.0.0—of course, this turned out to be incorrect, but what can ya do? 😆

If you have thoughts about what an API for that would look like, I’d love for you to open an issue!

---

<div class="post-metadata">

**Author:** ![brian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/brian/32/2180_2.png) [@brian](https://discourse.elm-lang.org/u/brian)\
**Post date:** [February 2, 2021, 2:58pm UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/8 "2021-02-02T14:58:58Z")

</div>

I’ve released [version 3.0.1](https://github.com/BrianHicks/elm-csv/releases/tag/3.0.0) of elm-csv. The major bump was necessary because error messages are _much_ better now. For one thing, you get all the error messages in the CSV instead of just one row. You also see the column where the error occurred.

But for maximum boredom, I’ve also added `Csv.Encode`. It does what it sounds like. (hi @edkelly303)

This version also fixes a bug in the parser where quoted fields would combine lines. Oops!

Finally, at 3.0.0 I’m considering elm-csv to be feature-complete. Unless the CSV format or Elm change dramatically, this library may never see another major release. I’m always open to new ideas, of course, but I haven’t found anything missing from the library while implementing a fairly complex decoding task at work, so I think we’re OK. I will keep up with bug fixes and Elm releases, though!

---

<div class="post-metadata">

**Author:** ![eimfach](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/eimfach/32/3247_2.png) [@eimfach](https://discourse.elm-lang.org/u/eimfach)\
**Post date:** [February 3, 2021, 3:53am UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/9 "2021-02-03T03:53:05Z")

</div>

This implementation might be a great update for my csv-batch-tagging tool ! I am especially interested in the error outputs … I gonna try it out !

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [February 13, 2021, 3:53am UTC](https://discourse.elm-lang.org/t/announcing-brianhicks-elm-csv-a-boring-csv-decoder/6797/10 "2021-02-13T03:53:19Z")

</div>

Closed on February 13, 2021, 3:53am UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
