Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use toMap for defining components? #178

Open
ocharles opened this issue Jul 25, 2019 · 4 comments
Open

Use toMap for defining components? #178

ocharles opened this issue Jul 25, 2019 · 4 comments

Comments

@ocharles
Copy link
Member

It feels like the new toMap keyword could be nicer for defining the components of a library. The keys are component names and the values are their definitions. Anyone any thoughts on this?

@quasicomputational
Copy link
Collaborator

I think I'm +1 on this, since using toMap will give you some static assurance about component name collisions, besides the nicer syntax. (We could even take that assurance further with, e.g., a single named-components : List { name: Text, component : < Test | Library | ... > } field!)

@ocharles
Copy link
Member Author

ocharles commented Aug 5, 2019

will give you some static assurance about component name collisions, besides the nicer syntax

Note that this is in some sense "opt-in" - you don't have to use toMap, you just have to supply a List { mapKey : Text, mapValue : Executable } (for the executables section). This means it's still possible to supply duplicates, and we should decide what to do in that case (I think just error out).

a single named-components field!

Should we do this at the same time? I do like it.

@quasicomputational
Copy link
Collaborator

Yeah, it's opt-in - but, since dhall-to-cabal is opt-in anyway, I think nudging people towards safer practice is sensible enough.

On named-components: OK, let's do it!

@ocharles
Copy link
Member Author

ocharles commented Aug 5, 2019

{ named-components : Map Text Component, library : Optional Library } ?

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

No branches or pull requests

2 participants