packages feed

aeson-value-parser 0.19.2 → 0.19.2.1

raw patch · 2 files changed

+12/−4 lines, 2 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

aeson-value-parser.cabal view
@@ -1,5 +1,5 @@ name: aeson-value-parser-version: 0.19.2+version: 0.19.2.1 synopsis: API for parsing "aeson" JSON tree into Haskell types description:   A flexible parser DSL of JSON AST produced by the \"aeson\" library@@ -35,7 +35,7 @@   build-depends:     aeson ==1.*,     attoparsec >=0.13 && <0.14,-    base >=4.9 && <5,+    base >=4.12 && <5,     bytestring >=0.10 && <0.12,     hashable >=1.3 && <2,     megaparsec >=8 && <10,
library/AesonValueParser.hs view
@@ -177,8 +177,16 @@ {-# INLINE mappedText #-} mappedText :: [(Text, a)] -> String a mappedText mappingList = let-  !hashMap = HashMap.fromList mappingList-  in narrowedText (flip HashMap.lookup hashMap)+  expectedValuesText = fromString (show (fmap fst mappingList))+  match lookup text = case lookup text of+    Just a -> Right a+    _ -> Left ("Unexpected value: \"" <> text <> "\". Expecting one of: " <> expectedValuesText)+  mappingListLength = length mappingList+  in if mappingListLength > 512+    then let+      !hashMap = HashMap.fromList mappingList+      in matchedText (match (flip HashMap.lookup hashMap))+    else matchedText (match (flip lookup mappingList))  {-# INLINE narrowedText #-} narrowedText :: (Text -> Maybe a) -> String a