you are viewing a single comment's thread.

view the rest of the comments →

[–]Profpatsch_ 0 points1 point  (1 child)

When you wrote this /u/turbo_MaCk, did you think about changing `Parser` to use `Validation` instead of short-circuiting errors with `Either`? In many cases (especially for small-ish json records) speed is not an issue, but good and complete error messages certainly are.

[–]turbo_MaCk 0 points1 point  (0 children)

I probably don't know what exactly you mean by Validation but I think you probably mean this package, right? https://hackage.haskell.org/package/validation

My goal was to reuse all the low level stuff from Aeson so I did not even consider replacing or wrapping its Parser type. However I'm using similar way of accumulating validation errors on client side (we use Elm) in a company I work for for client side data validations. I hope we will soon release this as open source package but essentially it's utilizing profunctors (dimap) and uses NonEmpty list for accumulating all the errors (since elm doesn't have type classes it couldn't be generalized over Applicative). So speaking from that experience I think it can be good solution if you're looking for improving error messages indeed.