Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Type Synonyms? #1

Closed
markandrus opened this issue Sep 8, 2017 · 3 comments
Closed

Type Synonyms? #1

markandrus opened this issue Sep 8, 2017 · 3 comments

Comments

@markandrus
Copy link

Hi,

I am trying to use dhall-bash for some more strongly-typed configuration I typically consume from Bash scripts. To this end, I want to introduce type synonyms for my configuration to distinguish various types of strings. I'm not sure how to make this work, though. Can you point me in the right direction? Here is my test script, test.dhall:

let MyText : Type = Text
in "Hello, World!" : MyText

And here is the output I receive:

$ dhall-to-bash < test.dhall


MyText : Type

Error: Expression doesn't match annotation

"Hello, World!" : MyText

(stdin):2:4

Thanks,
Mark

@Gabriella439
Copy link
Collaborator

This is related to the following two issues:

To summarize, those two issues, the current implementation only lets you share types via the import system, like this:

$ cat ./MyText
Text
$ cat example
"Hello, world!" : ./MyText

@markandrus
Copy link
Author

Ah, thanks very much @Gabriel439. I do wish there was some syntactic sugar on top of the import system for types that would allow me to land the MyText type in the same file, rather than in a separate file, but perhaps that should be discussed elsewhere. I will close this ticket now.

Thank you,
Mark

@Gabriella439
Copy link
Collaborator

You're welcome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants