generic-data
generic-data copied to clipboard
Better error messages
.
As previously discussed, we can create better error message for lack of instances for some types.
I'd like to integrate this into the library, but would like some guidance on where you would like the ErrorIfSum class to go.
Another consideration is how should compile-time error message be tested.
@yairchu Regarding testing of compile-time error messages: you can use doctest for that. See example from relude:
- https://github.com/kowainik/relude/blob/559ed98a1d3e2c15f2ec36a1c94e3b9b4e9484a1/src/Relude/Foldable/Fold.hs#L118-L139
Thanks for working on this!
I think it would make sense as a new .Internal.Error module. doctest is also a good idea!
And it may also be useful to export a couple of generics-related error combinators from the toplevel Generic.Data so they can be used by external instances for Generically (such as #21 discusses).
And it may also be useful to export a couple of generics-related error combinators from the toplevel Generic.Data so they can be used by external instances for Generically (such as #21 discusses).
Good point. After your feedback on the PR we could move on that. I would certainly want these for the external instances!