I'd like to be able to use a wider set of characters to compose record field names. My use case is that I'd like to interface with a system that uses YAML for configuration, and which expects keys that sometimes have colons in them. So for example, I'd like to have...
{ "something::complex" = 123 }
-> dhall-to-yaml ->
something::complex: 123
Yaml allows any arbitrary value as a key (strings, lists, etc...), but for my use case, all I need is to be able to use colons.
That sounds reasonable to me. I just created a pull request to amend the standard grammar:
https://github.com/dhall-lang/dhall-lang/pull/65
After a review period of a few days I'll merge that and update the Haskell implementation to match. Once that is done you should be able to use Dhall's support for quoted labels to do what you want, except with backticks instead of quotes:
{ `something::complex` = 123 }
Amazing, thank you!
This works for ::, but not for my|key (using pipe). Also it fails with =, >.
Is this a bug?
@feliksik | is not in the list of allowed symbols: https://github.com/dhall-lang/dhall-lang/blob/9203c77bfa8f96b3bc9a26016da94d27537d13b9/standard/dhall.abnf#L192
Thanks @Profpatsch, that explains it.
@feliksik: Note that this proposed change to the language expands the set of characters for quoted labels to permit |: https://github.com/dhall-lang/dhall-lang/pull/408
So once that is merged and implemented then my|key would be alloewd
Most helpful comment
That sounds reasonable to me. I just created a pull request to amend the standard grammar:
https://github.com/dhall-lang/dhall-lang/pull/65
After a review period of a few days I'll merge that and update the Haskell implementation to match. Once that is done you should be able to use Dhall's support for quoted labels to do what you want, except with backticks instead of quotes: