@@ -952,18 +952,15 @@ type ConName = String
952contextType :: TypeName -> Parser a -> Parser a
952contextType :: TypeName -> Parser a -> Parser a
953contextType = prependContext
953contextType = prependContext
957-- | Add the tagKey that will be looked up while building an ADT
955-- | Add the tagKey that will be looked up while building an ADT
958-- | Produce the error equivalent to
956-- | Produce the error equivalent to
959-- | Left "Error in $: parsing T failed, expected an object with keys "tag" and
957-- | Left "Error in $: parsing T failed, expected an object with keys "tag" and
960-- | "contents", where "tag" i-- |s associated to one of ["Foo", "Bar"],
958-- | "contents", where "tag" i-- |s associated to one of ["Foo", "Bar"],
961-- | The parser returned error was: could not find key "tag"
959-- | The parser returned error was: could not find key "tag"
962contextTag :: Text -> [String] -> Parser a -> Parser a
960contextTag :: Text -> [String] -> Parser a -> Parser a
963−contextTag tagKey cnames = prependFailure
961+contextTag tagKey cnames = modifyFailure (\_ ->
964− ("expected an object with key \"" ++ unpack tagKey ++
962+ ("expected Object with key \"" ++ unpack tagKey ++ "\"" ++
965− "\" where \"tag\" is associated to one of " ++ show cnames ++
963+ " associated to one of " ++ show cnames ++ "."))
966− ". The parser returned error was: ")
968-- | Add the name of the constructor being parsed to a parser's error messages.
965-- | Add the name of the constructor being parsed to a parser's error messages.
969contextCons :: ConName -> TypeName -> Parser a -> Parser a
966contextCons :: ConName -> TypeName -> Parser a -> Parser a
@@ -1163,8 +1160,6 @@ parseNonAllNullarySum p@(tname :* opts :* _) =
1163 "expected tag field to be one of " ++ show cnames ++
1160 "expected tag field to be one of " ++ show cnames ++
1164 ", but found tag " ++ show tag
1161 ", but found tag " ++ show tag
1165 cnames_ = unTagged2 (constructorTags (constructorTagModifier opts) :: Tagged2 f [String])
1162 cnames_ = unTagged2 (constructorTags (constructorTagModifier opts) :: Tagged2 f [String])
1166− --cname_ = conName (undefined :: M1 _i c _f _p)
1167− -- forall f a. ConstructorNames f
1169 ObjectWithSingleField ->
1164 ObjectWithSingleField ->
1170 withObject tname $ \obj -> case H.toList obj of
1165 withObject tname $ \obj -> case H.toList obj of