Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when using value of headerOrder for DefaultOrdered instance #163

Open
flip111 opened this issue Aug 3, 2018 · 1 comment

Comments

@flip111
Copy link

flip111 commented Aug 3, 2018

When using the value of headerOrder now you will see an error like this:

*** Exception: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
  undefined, called at ./Data/Csv/Encoding.hs:292:36 in cassava-0.5.1.0-5YJOfCvyfAxEy7HZ6afV23:Data.Csv.Encoding

Perhaps undefined can replaced with something like error "you are not allowed to use the argument to headerOrder"?

What is also possible is to change the type of headerOrder not to take any argument and use Proxy or type signature on call site headerOrder @MyType but this is probably not backwards compatible.

@mgajda
Copy link

mgajda commented Apr 16, 2020

I would recommend to use Data.Proxy to make sure compiler warns us about the error in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants