I'm trying to generate some YAML containing a map with dynamic keys, as described here. This works if I use Text
keys, but not when the keys have any other type. I'd like to use a union type for the keys if possible.
I've tried using different types for mapKey
, including a union type and Natural
, but with no success. I can work around the problem by converting all mapKey
values to Text
, but this isn't ideal.
Here's a minimal example of what I'm trying to do:
let Union = <A | B>
in
[{mapKey = Union.A, mapValue = "foo"}]
I'd expect it to generate YAML to be:
A: foo
but instead, the generated YAML looks like this:
- mapKey: A
mapValue: foo