Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FromJSON instance for better error msgs (#1882)
Before: ``` ghci> let s = "[{ \"radius\": 2, \"density\": \"x\"}]" ghci> eitherDecodeStrict s :: Either String GrowthSpread Left "Error in $: parsing Growth failed, expected Object, but encountered Array ``` The error msg above is misleading because we weren't trying to parse `Growth` datatype but `GrowthSpread` instead. After: ``` ghci> let s = "[{ \"radius\": 2, \"density\": \"x\"}]" ghci> eitherDecodeStrict s :: Either String GrowthSpread Left "Error in $: parsing GrowthSpread failed, expected Object, but encountered Array" ```
- Loading branch information