Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
I want to add an unpack operator, so you can write
[..xs]
instead of[for x in xs: x]
, possibly to replace the union operator too. But to be able to propagate type expectations into collection literals, I need a way to express “List[T]
orSet[T]
”.Solution
Defines a new type,
Collection[T]
. In the lattice, it is the meet ofList[T]
andSet[T]
. I have a feeling that it will make typechecking the union operator more elegant as well, so maybe we can keep|
after all. The new type fits in very naturally to the existing typechecking machinery, which is some evidence that the current iteration of #26 is a good approach.To do