generic-data icon indicating copy to clipboard operation
generic-data copied to clipboard

Better error messages

Open Lysxia opened this issue 7 years ago • 5 comments

.

Lysxia avatar Jul 08 '18 18:07 Lysxia

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 avatar Jul 04 '19 15:07 yairchu

@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

chshersh avatar Jul 04 '19 15:07 chshersh

Thanks for working on this!

I think it would make sense as a new .Internal.Error module. doctest is also a good idea!

Lysxia avatar Jul 04 '19 15:07 Lysxia

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).

Lysxia avatar Jul 04 '19 16:07 Lysxia

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!

yairchu avatar Jul 04 '19 16:07 yairchu