env:VAR and Unions


This is what I want to do:

export QUX=foo
let FooBarBaz : Type = < foo | bar | baz >
in env:QUX as FooBarBaz : Type

Currently I’m doing like:

export QUX="($(find-this-files-absolute-path-in-bash)/FooBarBaz.dhall).Type.foo"

This is fine, but people agree that it’s kind of ugly and really ties that env var to Dhall rather than looking rather agnostic.

Is there way to do this as what I wanted? Perhaps it could be done with merge but a) it’s midnight and b) it seems really ugly and not dry merge { foo = FooBar.Baz.Type.foo, ... }. When I see json-to-dhall being able to figure out this string-to-union situation, surely there’s solution.

Goodnight and thanks :heart:



export QUX=<foo|bar|baz>.foo

something that is suitable for your case?


No, because that union could easily change to add new values.


@toastal: Yeah, we got a similar request on the Functional Programming Slack and created two separate issues to collect ideas for how to address this.

The first issue discusses more general solutions to the problem:

… and the second issue discusses simpler special-purpose solutions:


I’ll follow the issues. I could just swear that there was a way around this since json-to-dhall can go from text to Dhall just fine. :sweat_smile: