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

Why visibility is a string and not a union type? #36

Closed
Antontelesh opened this issue Dec 13, 2015 · 2 comments
Closed

Why visibility is a string and not a union type? #36

Antontelesh opened this issue Dec 13, 2015 · 2 comments

Comments

@Antontelesh
Copy link

I'm new to Elm and reading code to understand language and patterns.
For me it seems like making visibility a union type would be better for understanding the code and type safety. Isn't it?

type Visibility
  = Active
  | Completed
  | All
@jwmerrill
Copy link

I tried making this change: master...jwmerrill:visibility-type

It mostly worked out nicely. The compiler told me everything I needed to do after I created the Visibility type and changed the type of Model.

However, you can't currently serialize a Union Type directly through a port, so if you make this change, the serialization to localStorage gets more complicated. I just ripped that feature out in my branch, so it isn't suitable for a PR. I think this won't be easy until elm/compiler#490 is solved.

@Antontelesh
Copy link
Author

@jwmerrill Thank you for this investigation and explanation. Now it is clear for me.

@evancz evancz closed this as completed May 11, 2016
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

3 participants