Hello community, here is the log from the commit of package ghc-yaml for openSUSE:Factory checked in at 2015-09-02 00:36:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-yaml (Old) and /work/SRC/openSUSE:Factory/.ghc-yaml.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-yaml" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-yaml/ghc-yaml.changes 2015-08-27 08:55:36.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-yaml.new/ghc-yaml.changes 2015-09-02 00:36:16.000000000 +0200 @@ -1,0 +2,6 @@ +Mon Aug 31 08:46:59 UTC 2015 - mimi...@gmail.com + +- update to 0.8.14 +* Pretty print improvements for exceptions + +------------------------------------------------------------------- Old: ---- yaml-0.8.13.tar.gz New: ---- yaml-0.8.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-yaml.spec ++++++ --- /var/tmp/diff_new_pack.vv6JmB/_old 2015-09-02 00:36:17.000000000 +0200 +++ /var/tmp/diff_new_pack.vv6JmB/_new 2015-09-02 00:36:17.000000000 +0200 @@ -18,7 +18,7 @@ %global pkg_name yaml Name: ghc-yaml -Version: 0.8.13 +Version: 0.8.14 Release: 0 Summary: Support for parsing and rendering YAML documents License: BSD-3-Clause ++++++ yaml-0.8.13.tar.gz -> yaml-0.8.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.13/ChangeLog.md new/yaml-0.8.14/ChangeLog.md --- old/yaml-0.8.13/ChangeLog.md 2015-08-13 12:42:36.000000000 +0200 +++ new/yaml-0.8.14/ChangeLog.md 2015-08-30 08:11:27.000000000 +0200 @@ -1,3 +1,7 @@ +## 0.8.14 + +* Pretty print improvements for exceptions [#67](https://github.com/snoyberg/yaml/pull/67) + ## 0.8.13 * Pretty module [#66](https://github.com/snoyberg/yaml/pull/66) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.13/Data/Yaml/Internal.hs new/yaml-0.8.14/Data/Yaml/Internal.hs --- old/yaml-0.8.13/Data/Yaml/Internal.hs 2015-08-13 12:42:36.000000000 +0200 +++ new/yaml-0.8.14/Data/Yaml/Internal.hs 2015-08-30 08:11:27.000000000 +0200 @@ -19,6 +19,7 @@ import Text.Libyaml hiding (encode, decode, encodeFile, decodeFile) import Data.ByteString (ByteString) import qualified Data.Map as Map +import Data.Maybe (isNothing) import Control.Exception import Control.Exception.Enclosed import Control.Monad.Trans.State @@ -66,36 +67,44 @@ -- Instead of displaying the data constructors applied to their arguments, -- a more textual output is returned. For example, instead of printing: -- --- > AesonException "The key \"foo\" was not found" +-- > InvalidYaml (Just (YamlParseException {yamlProblem = "did not find expected ',' or '}'", yamlContext = "while parsing a flow mapping", yamlProblemMark = YamlMark {yamlIndex = 42, yamlLine = 2, yamlColumn = 12}}))) -- -- It looks more pleasant to print: -- --- > Aeson exception: The key "foo" was not found +-- > YAML parse exception at line 2, column 12, +-- > while parsing a flow mapping: +-- > did not find expected ',' or '}' -- -- Since 0.8.11 prettyPrintParseException :: ParseException -> String -prettyPrintParseException NonScalarKey = "Non scalar key" -prettyPrintParseException (UnknownAlias n) = - "Unknown alias: " ++ n -prettyPrintParseException (UnexpectedEvent r e) = unlines - [ "Unexpected event:" - , " Received: " ++ maybe "None" show r - , " Expected: " ++ maybe "None" show e +prettyPrintParseException pe = case pe of + NonScalarKey -> "Non scalar key" + UnknownAlias anchor -> "Unknown alias `" ++ anchor ++ "`" + UnexpectedEvent mbExpected mbUnexpected -> unlines + [ "Unexpected event: expected" + , " " ++ show mbExpected + , "but received" + , " " ++ show mbUnexpected ] -prettyPrintParseException (InvalidYaml mye) = - case mye of - Just ye -> "Invalid yaml: " ++ show ye - _ -> "Invalid yaml" -prettyPrintParseException (AesonException e) = - "Aeson exception: " ++ e -prettyPrintParseException (OtherParseException e) = - "Parse exception: " ++ show e -prettyPrintParseException (NonStringKeyAlias n v) = unlines - [ "Non-string key alias:" - , " Anchor name: " ++ n - , " Value: " ++ show v + InvalidYaml mbYamlError -> case mbYamlError of + Nothing -> "Unspecified YAML error" + Just yamlError -> case yamlError of + YamlException s -> "YAML exception:\n" ++ s + YamlParseException problem context mark -> unlines + [ "YAML parse exception at line " ++ show (yamlLine mark) ++ + ", column " ++ show (yamlColumn mark) ++ "," + -- The context seems to include a leading "while" or similar. + , context ++ ":" + , problem + ] + AesonException s -> "Aeson exception:\n" ++ s + OtherParseException exc -> "Generic parse exception:\n" ++ show exc + NonStringKeyAlias anchor value -> unlines + [ "Non-string key alias:" + , " Anchor name: " ++ anchor + , " Value: " ++ show value ] -prettyPrintParseException CyclicIncludes = "Cyclic includes" + CyclicIncludes -> "Cyclic includes" newtype PErrorT m a = PErrorT { runPErrorT :: m (Either ParseException a) } instance Monad m => Functor (PErrorT m) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.13/Data/Yaml.hs new/yaml-0.8.14/Data/Yaml.hs --- old/yaml-0.8.13/Data/Yaml.hs 2015-08-13 12:42:36.000000000 +0200 +++ new/yaml-0.8.14/Data/Yaml.hs 2015-08-30 08:11:27.000000000 +0200 @@ -167,7 +167,7 @@ decodeEither :: FromJSON a => ByteString -> Either String a decodeEither bs = unsafePerformIO - $ fmap (either (Left . show) id) + $ fmap (either (Left . prettyPrintParseException) id) $ decodeHelper (Y.decode bs) -- | More helpful version of 'decodeEither' which returns the 'YamlException'. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.13/yaml.cabal new/yaml-0.8.14/yaml.cabal --- old/yaml-0.8.13/yaml.cabal 2015-08-13 12:42:36.000000000 +0200 +++ new/yaml-0.8.14/yaml.cabal 2015-08-30 08:11:27.000000000 +0200 @@ -1,5 +1,5 @@ name: yaml -version: 0.8.13 +version: 0.8.14 license: BSD3 license-file: LICENSE author: Michael Snoyman <mich...@snoyman.com>, Anton Ageev <ant...@gmail.com>,Kirill Simonov