aeson-value-parser 0.19.0.1 → 0.19.1
raw patch · 2 files changed
+9/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ AesonValueParser: narrowedText :: (Text -> Maybe a) -> String a
Files
aeson-value-parser.cabal view
@@ -1,5 +1,5 @@ name: aeson-value-parser-version: 0.19.0.1+version: 0.19.1 synopsis: API for parsing "aeson" JSON tree into Haskell types description: A flexible parser DSL of JSON AST produced by the \"aeson\" library
library/AesonValueParser.hs view
@@ -22,6 +22,7 @@ -- * String parsers String, text,+ narrowedText, matchedText, attoparsedText, megaparsedText,@@ -171,6 +172,13 @@ {-# INLINE text #-} text :: String Text text = String ask++{-# INLINE narrowedText #-}+narrowedText :: (Text -> Maybe a) -> String a+narrowedText narrow = matchedText match where+ match text = case narrow text of+ Just a -> Right a+ _ -> Left ("Unexpected value: \"" <> text <> "\"") {-# INLINE matchedText #-} matchedText :: (Text -> Either Text a) -> String a