Skip to content

yaml-to-dhall: how to force a particular union alternative when alternatives have the same type? #1905

Open
@ari-becker

Description

@ari-becker

Running:

yaml-to-dhall '< Foo : Natural | Bar : Natural >' <<< 'Foo: 20'

Results in:

Error: $: Dhall type expression and YAML value do not match:

Expected Dhall type:
< Bar : Natural | Foo : Natural >

YAML:
Foo: 20

while running:

yaml-to-dhall '< Foo : Natural | Bar : Natural >' <<< '20'

Results in:

< Bar : Natural | Foo : Natural >.Bar 20

I understand that I can use --unions-strict to turn the second case into an error, but is there a way that I can get yaml-to-dhall to reliably return < Bar : Natural | Foo : Natural >.Foo 20?

Discovered while trying to parse into this type: https://github.com/coralogix/dhall-utility-library/blob/8ad768e4a7ab313b5ee1b01c093ffdd1fef379c7/kubernetes/Space.dhall

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions