Closed RiugaBachi closed 2 years ago
Some personal thoughts on the current usage of undefined
:
- I feel like we should define the routes manually (by hand), just as the model types are being defined.
niceRoute
andbadRoute
seem like abstractions we can do away with.
This is true, I didn't end up using as many custom routes as I thought I was going to.
- I'm unclear on if we need to test the
Type rep field name lookup
andType rep indexing
cases. How often do they happen in a real-world scenario?
Probably not a lot and frankly I was being pedantic. Once this becomes automated though, it shouldn't be a concern, so for now would you saying labeling these as low priority for manual testing would be good?
- Instead of having to uncomment every snippet by hand, can we use CPP to toggle them on and off with a single line change? I plan to rely on HLS (rather than repl) to test it, and I imagine I could just use the hover tooltip to read the error.
Good idea actually.
An update on the original issues:
I feel like we should define the routes manually (by hand), just as the model types are being defined. niceRoute and badRoute seem like abstractions we can do away with.
I realized the reason I did this in the first place was because we're testing the same data structure but with different deriving clauses, so if we do write it out by hand that's n
route types + naming conflicts to deal with.
I'm unclear on if we need to test the Type rep field name lookup and Type rep indexing cases. How often do they happen in a real-world scenario?
Labeled these as low priority in source for now.
Instead of having to uncomment every snippet by hand, can we use CPP to toggle them on and off with a single line change? I plan to rely on HLS (rather than repl) to test it, and I imagine I could just use the hover tooltip to read the error.
Implemented.
Apologies for that, I probably accidentally deleted the TemplateHaskell pragma at the top and didn't realize it.
:ok_hand: No prob, take your time. This is understandably a very low priority PR lol. Expanded the TH splice documentation a bit in the meantime.
As discussed in this comment of #120:
This PR adds the proposed testing plan document residing under
docs/testing.md
, as well as atest-type-errors
test suite that currently houses an (informal, manually-verified-for-now) specification for custom errors related to route generic deriving. This has been designed to be as painless as possible to automate in the future via some minimal TH plumbing, while still being plenty legible for human eye verification.These tests have caught a few unhandled cases / regressions in #120 as well, which I plan to submit a PR for separately after this is resolved. If the expected error does not line up what what GHC outputs, this is probably the reason why.