Hey, I was experimenting with different APIs for decoders (e.g. JSON parsers). I have found a way to write decoders in a very clean and understandable way. I am looking for feedback on the API and maybe some other ideas.
https://github.com/Hackder/decoders_gleam/blob/master/test/dec_test.gleam
This is a showcase of the api. The repo contains more experiments and also a solution by @glass osprey which he showcased on stream recently. (I copy pasted to play around with it).
The criteria for creating my decoders was:
- Locality of behavior - single property defined on a single line.
- Reports all errors
I first created buch of monadic parsers (exits on first error). Those are also in the repo. May be worth to consider.
Thanks to everyone who finds the time to give some feedback 🙂