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

types: define Void #280

Merged
merged 1 commit into from
Jan 13, 2020
Merged

types: define Void #280

merged 1 commit into from
Jan 13, 2020

Conversation

davidchambers
Copy link
Member

I struggled with the description, and I'm not completely satisfied with the first sentence of the second paragraph. Suggestions are welcome. :)

@Avaq
Copy link
Member

Avaq commented Jan 8, 2020

What's the motivation behind the addition of this type?

@davidchambers
Copy link
Member Author

What's the motivation behind the addition of this type?

While @voxbono and I were working on a functional server we decided to use futures for HTTP responses. We then realized we had no use for the first type parameter: even if the database was inaccessible we could resolve with a Response value for a server error. I was about to suggest using Future Null Response but realized that Future Void Response would convey more information.

@Avaq
Copy link
Member

Avaq commented Jan 9, 2020

Hmm, usually Future a Response conveys just as much information - it is assumed that a completely unrestricted type variable has no concrete type.

The problem with Future a Response is that reject (42) is a valid member of it from the perspective of the type checker.

So you want a type that says "the type at this position must never become concrete". Maybe the description could be something like:

Indicates that the type will never become concrete. For example, a future of type Future Void String will never be rejected.

@davidchambers
Copy link
Member Author

Indicates that the type will never become concrete.

I'm not completely satisfied with this sentence either. I'm struggling to use a type to indicate that no value will ever be present at the position in question as I lack terminology for associating values with type parameters.

@Avaq
Copy link
Member

Avaq commented Jan 10, 2020

the type at this position must never become concrete

will ever be present at the position in question

I guess we both think of it as "position". Maybe we can use this word?

@Avaq
Copy link
Member

Avaq commented Jan 10, 2020

When talking in terms of "concreteness" we can refer to the type, however.

@davidchambers
Copy link
Member Author

I like “position”. The current description refers to position, albeit indirectly:

May be used to convey that a type parameter of an algebraic data type will not be used.

This, for example, refers to the positional arguments a and b in Future a b.

I'll merge this pull request in its current form, but I'd like to improve the description in the future.

@davidchambers davidchambers merged commit 267f848 into master Jan 13, 2020
@davidchambers davidchambers deleted the davidchambers/void branch January 13, 2020 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants