You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function types would probably be fine as we can coerce the types easily when lambda expression added.
e.g. \x y -> f x y
The most problematic part is List types.
Coerce types implicitly in list expressions?
The syntax looks like coercing types of each element one by one, which is consistent with the other non-function type subsumption.
xs : List Number
ys : List (Number | None)
ys = [ ...xs ] # valid
f : List (Number | None) -> None
z = f xs # type error because List Number /= List (Number | None)
Formulation
Any generic types except union types would support neither covariance nor contravariance.
A | B <: C <=> A <: C && B <: C
A <: B | C <=> A == B || A == C
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
(user-defined type) <: (interface)
(interface) <: (interface)
\x y -> f x y
List
types.Formulation
References
Beta Was this translation helpful? Give feedback.
All reactions