@@ -1,5 +1,5 @@
1{-# LANGUAGE CPP, FlexibleInstances, NamedFieldPuns, NoImplicitPrelude,
1{-# LANGUAGE CPP, FlexibleInstances, NamedFieldPuns, NoImplicitPrelude,
2− OverlappingInstances, TemplateHaskell, UndecidableInstances
2+ OverlappingInstances, TemplateHaskell, UndecidableInstances, IncoherentInstances
@@ -496,6 +496,14 @@ consFromJSON tName opts cons = do
496 'conNotFoundFail2ElemArray
496 'conNotFoundFail2ElemArray
499+ , do other <- newName "other"
502+ $ [|firstElemNoStringFail|]
503+ `appE` (litE $ stringL $ show tName)
504+ `appE` ([|valueConName|] `appE` varE other)
@@ -735,6 +743,9 @@ noArrayFail t o = fail $ printf "When parsing %s expected Array but got %s." t o
735noObjectFail :: String -> String -> Parser fail
743noObjectFail :: String -> String -> Parser fail
736noObjectFail t o = fail $ printf "When parsing %s expected Object but got %s." t o
744noObjectFail t o = fail $ printf "When parsing %s expected Object but got %s." t o
746+firstElemNoStringFail :: String -> String -> Parser fail
747+firstElemNoStringFail t o = fail $ printf "When parsing %s expected an Array of 2 elements where the first element is a String but got %s at the first element." t o
738wrongPairCountFail :: String -> String -> Parser fail
749wrongPairCountFail :: String -> String -> Parser fail
739wrongPairCountFail t n =
750wrongPairCountFail t n =
740 fail $ printf "When parsing %s expected an Object with a single name/value pair but got %s pairs."
751 fail $ printf "When parsing %s expected an Object with a single name/value pair but got %s pairs."
@@ -748,7 +759,7 @@ noMatchFail t o =
748 fail $ printf "When parsing %s expected a String with the name of a constructor but got %s." t o
759 fail $ printf "When parsing %s expected a String with the name of a constructor but got %s." t o
750not2ElemArray :: String -> Int -> Parser fail
761not2ElemArray :: String -> Int -> Parser fail
751−not2ElemArray t i = fail $ printf "When parsing %s expected an Array of 2-elements but got %i elements" t i
762+not2ElemArray t i = fail $ printf "When parsing %s expected an Array of 2 elements but got %i elements" t i
753conNotFoundFail2ElemArray :: String -> [String] -> String -> Parser fail
764conNotFoundFail2ElemArray :: String -> [String] -> String -> Parser fail
754conNotFoundFail2ElemArray t cs o =
765conNotFoundFail2ElemArray t cs o =