[Haskell-cafe] Need help to get started
Henning Thielemann
lemming at henning-thielemann.de
Sat Oct 17 22:18:31 UTC 2020
On Sat, 17 Oct 2020, Jack Kelly via Haskell-Cafe wrote:
> 3. At this stage, we have a parsing problem. We want a function like `parseEntry :: Text -> Either Text Entry`, where the `Left` side would be an error message (if that line fails to parse), or the `Entry` describing that line. I can see a couple of ways to attack this:
>
> a) Use Text.words and continue with ad-hoc parsing. You may find yourself reinventing wheels that are in the library ecosystem, but for learning that might be fine?
> b) Use a library like megaparsec and write a full-blown parser. You will get more for free, but the learning curve may be steeper.
The text file looks like space-separated values. Thus, the cassava library
may help parsing stuff into the data type.
More information about the Haskell-Cafe
mailing list