dhall-haskell icon indicating copy to clipboard operation
dhall-haskell copied to clipboard

dhall-to-yaml incorrectly renders string values when value ends in a colon

Open timspeetjens opened this issue 4 years ago • 2 comments

Using the following dhall, dhall-to-yaml does not render correctly:

{ a = [ "v:" ], b = "c:" }
$ dhall-to-yaml < t.dhall
a:
  - v:
b: c:

Both dhall-to-yaml-ng and dhall-to-json render it as expected:

$ dhall-to-yaml-ng < t.dhall 
a:
- "v:"
b: "c:"

$ dhall-to-json < t.dhall 
{
  "a": [
    "v:"
  ],
  "b": "c:"
}

Tested with dhall-to-yaml/dhall-to-json versions 1.7.4 and 1.7.6, and dhall-to-yaml-ng versions 1.2.4 and 1.2.6.

timspeetjens avatar May 20 '21 06:05 timspeetjens

While it escaped to me, at first, output from dhall-to-yaml and dhall-to-yaml-ng are both correct, but not identical:

In the given example, indentation for arrays differ, and double quotes are added in many more places (than just string values with trailing colons):

$ dhall-to-yaml <<< '{ a-a = [ "v-v"] }'
a-a:
  - v-v

$ dhall-to-yaml-ng <<< '{ a-a = [ "v-v"] }'
"a-a":
- "v-v"

timspeetjens avatar May 20 '21 07:05 timspeetjens

Using the following dhall, dhall-to-yaml does not render correctly:

{ a = [ "v:" ], b = "c:" }
$ dhall-to-yaml < t.dhall
a:
  - v:
b: c:

This is due to https://github.com/clovyr/aeson-yaml/issues/12.

sjakobi avatar May 27 '21 10:05 sjakobi