dhall-haskell
dhall-haskell copied to clipboard
dhall-nix Use z-encoding for nix symbol names
When trying to encode a function like
\(Foo/Bar: Text) -> Foo/Bar
I get the nix code
Foo/Bar:
Foo/Bar
which fails with the nix parsing error
error: syntax error, unexpected ':', expecting end of file
at «string»:1:8:
1| Foo/Bar:
| ^
… this is not good, because “namespaced” symbols like that are quite frequent in dhall code.
I would suggest using the Z-Encoding scheme that is also used by GHC to create nix symbols.
You can escape identifiers using backticks, like this:
λ(`Foo/Bar` : Text) → `Foo/Bar`
Yeah, but the generated nix code is still not valid nix syntax, this generates
Foo/Bar:
Foo/Bar