4 ms·
Same. Until I discovered those parser combinator libraries which are THE way to do parsing in Haskell. It makes parsing so pleasant you'll never need a regex ag
by ngruhn 1y ago
Same. Until I discovered those parser combinator libraries which are THE way to do parsing in Haskell. It makes parsing so pleasant you'll never need a regex again. A parser for that CSV file probably looks like this:
line = decimal `sepBy` char ','
file = line `sepBy` newline
That's it. It almost reads like prose.
- djtango 1y agoThanks for sharing! This was in a pre-LLM era and I couldn't be bothered to research the right way to do this. Those parser combinators are excellent, so clean
- rafram 1y agoThat wouldn’t be a very good CSV parser.
- Tainnor 1y agoIt doesn't have to be a general purpose CSV parser, it just has to be able to parse the specific AoC input