-
Notifications
You must be signed in to change notification settings - Fork 0
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
Intersection types #79
Comments
The Although this doesn't matter as >> only returns its right operand anyway, since it relies on side effects. |
An example use case is for the |
This would also help in defining an unordered tuple type (see also #78 for the ordered variant). That is, a type that is a supertype of both There are probably a lot of problems with this (for one, the type taxonomy would be cyclic). The |
I gave it some more thought. What should probably happen is the following: We should have an Intersection type. We should have a Top and Bottom type; top representing a value of any type (thus a supertype of all types) and bottom representing a type which has no values (thus a subtype of all types). Then, in the CCT algebra, Unfortunately, I think this will complicate the type inference a lot, and I need to give it some thought. ...And read papers, probably. For consistency, Tuple types should be renamed Product types. |
Top and bottom types should get a separate issue (EDIT: #94). We need them more urgently because it will help us in using types of the form |
This is now leading to an issue: the question parser often returns As indicated in #79 (comment) I think the correct solution is to have intersection types in this library. However, as a temporary solution, in queries, we can convert |
Later, intersection types should be introduced so that `R(x, y)` is a supertype of `R(x, y & z)` and `R(x, z & y)`. cf. quangis/transforge#79 (comment)
Until #79 is implemented, as of 11bc3fc we work around the issue of intersection types by using choice, as described in #77. That is, if we want to query for `R(x, y)`, we also accept `R(x, y & z)` (or, temporarily using product types for intersection types, `R(x, y * z)`. However, this means that when we are querying for workflows that contain an intersection type, we can't just ignore it: we must query for `{... R(x, y * z)} UNION { ... R(x, y)}`. This is implemented with this commit, but it should surely not be the solution we end up with.
The product type |
In the meeting, we figured out that a workflow was generated that feeds a source of type R(Obj, Reg * Nom) into the second input of a ZonalStatisticsMeanInterval, the output which in turn gets passed into a LoadCountAmounts along with a second use of the same source, now interpreted as a R(Obj, Count). This is another instance of the issue described in quangis/transforge#79: we really want to sometimes describe multiple attributes of the same thing. See also quangis/transforge#79 (comment) We now work around it by being consistent with the annotation.
Now that #74 has freed up the pipe operator
|
, it will now be possible to implement operator overloading with yet another mechanism, on top of subtype polymorphism and parametric polymorphism. That is, we could consider adding the following, with an intuitive reading:This is somewhat possible already using parametric polymorphism:
However, applying either an
A
or aC
to this function will not result in, respectively,B
andD
, but rather in a variabley[B]
ory[D]
. This means that subsequent uses of the result will correctly fail where it should, but we obtain no fixed type to reason with. The above solution would address this.In mild defiance of the YAGNI principle, I'm pre-emptively publishing this, as it's likely that this will pop up if the library is ever used by others, but it is not necessary for the CCT algebra and so I will not work on it right now.
The text was updated successfully, but these errors were encountered: