yaml 0.8.5.2 → 0.8.5.3
raw patch · 3 files changed
+11/−7 lines, 3 filesdep ~aeson
Dependency ranges changed: aeson
Files
- Data/Yaml.hs +3/−4
- test/main.hs +6/−1
- yaml.cabal +2/−2
Data/Yaml.hs view
@@ -80,12 +80,12 @@ import qualified Data.Vector as V import Data.Text (Text, pack) import qualified Data.Text as T-import Data.Text.Read (signed, decimal, double) import Data.Text.Encoding (encodeUtf8, decodeUtf8With) import Data.Text.Encoding.Error (lenientDecode) import qualified Data.HashMap.Strict as M import Data.Typeable-import Data.Attoparsec.Number+import Data.Attoparsec.ByteString (parseOnly)+import Data.Aeson.Parser (value) import qualified Data.HashSet as HashSet encode :: ToJSON a => a -> ByteString@@ -210,8 +210,7 @@ | t `elem` ["null", "Null", "NULL", "~", ""] = Null | any (t `isLike`) ["y", "yes", "on", "true"] = Bool True | any (t `isLike`) ["n", "no", "off", "false"] = Bool False- | Right (x, "") <- signed decimal t = Number $ I x- | Right (x, "") <- double t = Number $ D x+ | Right (Number n) <- parseOnly value (encodeUtf8 t) = Number n | otherwise = String t where x `isLike` ref = x `elem` [ref, T.toUpper ref, titleCased] where titleCased = toUpper (T.head ref) `T.cons` T.tail ref
test/main.hs view
@@ -89,7 +89,12 @@ describe "pretty output" $ do it "simple nulls" $ D.encode (object ["foo" .= D.Null]) `shouldBe` "foo: null\n"- it "simple numbers" $ D.encode (object ["foo" .= (4 :: Int)]) `shouldBe` "foo: 4\n"+ it "simple numbers" $ D.encode (object ["foo" .= (4 :: Int)]) `shouldBe`+#if MIN_VERSION_aeson(0, 7, 0)+ "foo: 4.0\n" -- FIXME should this be reported as a bug upstream to aeson?+#else+ "foo: 4\n"+#endif it "True" $ D.encode (object ["foo" .= True]) `shouldBe` "foo: true\n" it "False" $ D.encode (object ["foo" .= False]) `shouldBe` "foo: false\n" it "simple string" $ D.encode (object ["foo" .= ("bar" :: T.Text)]) `shouldBe` "foo: bar\n"
yaml.cabal view
@@ -1,5 +1,5 @@ name: yaml-version: 0.8.5.2+version: 0.8.5.3 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov @@ -95,7 +95,7 @@ , conduit , yaml , text- , aeson >= 0.6.2+ , aeson , unordered-containers , vector ghc-options: -Wall