dhall-yaml 1.0.2 → 1.0.3
raw patch · 8 files changed
+36/−8 lines, 8 filesdep ~dhallPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: dhall
API changes (from Hackage documentation)
Files
- CHANGELOG.md +12/−0
- dhall-yaml.cabal +3/−3
- src/Dhall/Yaml.hs +11/−1
- tasty/Main.hs +1/−3
- tasty/data/normal.dhall +2/−0
- tasty/data/normal.yaml +3/−1
- tasty/data/quoted.dhall +2/−0
- tasty/data/quoted.yaml +2/−0
CHANGELOG.md view
@@ -1,3 +1,15 @@+1.0.3++* [yaml: Single-quote date/bool string fields](https://github.com/dhall-lang/dhall-haskell/commits/master/dhall-json)++1.0.2++* Build against `dhall-1.30.0`++1.0.1++* Build against `dhall-1.29.0`+ 1.0.0 * Initial release
dhall-yaml.cabal view
@@ -1,8 +1,8 @@ Name: dhall-yaml-Version: 1.0.2+Version: 1.0.3 Cabal-Version: >=1.8.0.2 Build-Type: Simple-Tested-With: GHC == 8.0.2, GHC == 8.4.3, GHC == 8.6.1+Tested-With: GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1 License: GPL-3 License-File: LICENSE Copyright: 2019 Gabriel Gonzalez@@ -37,7 +37,7 @@ base >= 4.8.0.0 && < 5 , aeson >= 1.0.0.0 && < 1.5 , bytestring < 0.11,- dhall >= 1.28.0 && < 1.31,+ dhall >= 1.31.0 && < 1.32, dhall-json >= 1.6.0 && < 1.7 , optparse-applicative >= 0.14.0.0 && < 0.16, text >= 0.11.1.0 && < 1.3 ,
src/Dhall/Yaml.hs view
@@ -17,6 +17,7 @@ import qualified Data.Aeson import qualified Data.ByteString+import qualified Data.Char as Char import qualified Data.Text as Text import qualified Data.Vector import qualified Data.YAML as Y@@ -60,8 +61,17 @@ style (Y.SStr s) | "\n" `Text.isInfixOf` s = Right (YE.untagged, YE.Literal YE.Clip YE.IndentAuto, s)- | quoted =+ | quoted || Text.all isNumberOrDateRelated s || isBoolString = Right (YE.untagged, YE.SingleQuoted, s)+ where+ isBoolString+ | Text.length s > 5 = False+ | otherwise =+ case Text.toLower s of+ "true" -> True+ "false" -> True+ _ -> False+ isNumberOrDateRelated c = Char.isDigit c || c == '.' || c == 'e' || c == '-' style s = YS.schemaEncoderScalar Y.coreSchemaEncoder s
tasty/Main.hs view
@@ -14,7 +14,6 @@ import qualified Dhall.Yaml import qualified GHC.IO.Encoding import qualified Test.Tasty-import qualified Test.Tasty.ExpectedFailure import qualified Test.Tasty.HUnit main :: IO ()@@ -38,8 +37,7 @@ , testDhallToYaml Dhall.JSON.Yaml.defaultOptions "./tasty/data/emptyMap"- , Test.Tasty.ExpectedFailure.ignoreTestBecause "#1516" $- testDhallToYaml+ , testDhallToYaml (Dhall.JSON.Yaml.defaultOptions { quoted = True }) "./tasty/data/quoted" ]
tasty/data/normal.dhall view
@@ -2,5 +2,7 @@ , text = ./yaml.txt as Text , int_value = 1 , bool_value = True+, bool_string = "true" , yes = "y"+, hello_world = "hello world" }
tasty/data/normal.yaml view
@@ -1,6 +1,8 @@+bool_string: 'true' bool_value: true+hello_world: hello world int_value: 1-string_value: "2000-01-01"+string_value: '2000-01-01' text: | Plain text yes: y
tasty/data/quoted.dhall view
@@ -2,5 +2,7 @@ , text = ./yaml.txt as Text , int_value = 1 , bool_value = True+, bool_string = "true" , yes = "y"+, hello_world = "hello world" }
tasty/data/quoted.yaml view
@@ -1,4 +1,6 @@+'bool_string': 'true' 'bool_value': true+'hello_world': 'hello world' 'int_value': 1 'string_value': '2000-01-01' 'text': |