cassava icon indicating copy to clipboard operation
cassava copied to clipboard

Better error message when using value of headerOrder for DefaultOrdered instance

Open flip111 opened this issue 7 years ago • 1 comments

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.

flip111 avatar Aug 03 '18 15:08 flip111

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

mgajda avatar Apr 16 '20 12:04 mgajda