yaml-combinators 1.1 → 1.1.1
raw patch · 3 files changed
+20/−1 lines, 3 files
Files
- ChangeLog.md +4/−0
- src/Data/Yaml/Combinators.hs +15/−0
- yaml-combinators.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for yaml-combinators +## 1.1.1++Add `anyValue`, which parses any JSON value+ ## 1.1 * Add `null_`
src/Data/Yaml/Combinators.hs view
@@ -28,6 +28,7 @@ , optField , defaultField , theField+ , anyValue -- * Errors , ParseError(..) , ppParseError@@ -164,6 +165,9 @@ -- since its branch is more likely to be the right one | otherwise = lessSevere e1 e2 +-- | Pretty-print a 'ParseError'+--+-- @since 1.1 ppParseError :: ParseError -> String ppParseError (ParseError _lvl reason) = case reason of@@ -369,6 +373,8 @@ -- -- >>> parse null_ "null" -- Right ()+--+-- @since 1.1 null_ :: Parser () null_ = fromComponent $ S . S . S . S . S . Z $ ParserComponent $ Just $ const $ \Nil -> pure () @@ -479,6 +485,15 @@ let v = o HM.! name in Validation . Left $ ParseError 0 $ UnexpectedAsPartOf (Object (HM.singleton name v)) (Object o) )++-- | Match any JSON value and return it as Aeson's 'Value'.+--+-- >>> parse anyValue "[one, two, {three: four}]"+-- Right (Array [String "one",String "two",Object (fromList [("three",String "four")])])+--+-- @since 1.1.1+anyValue :: Parser Value+anyValue = Parser $ hpure $ ParserComponent . Just $ \val _np -> pure val -- | Like 'lift' for 'ReaderT', but doesn't require a 'Monad' instance liftR :: f a -> ReaderT r f a
yaml-combinators.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: yaml-combinators-version: 1.1+version: 1.1.1 synopsis: YAML parsing combinators for improved validation and error reporting description: Based on the article <https://ro-che.info/articles/2015-07-26-better-yaml-parsing Better Yaml Parsing>.