Allow existential types introduced in a constructor pattern to be bound without tuple type constraints patterns #12935
Replies: 5 comments
-
When I needed a locally abstract type like this, I found myself naturally reaching out for the |
Beta Was this translation helpful? Give feedback.
-
Not really an answer to this issue, but it may help to consider the history of this fairly-recent feature, that prominently features syntax discussions. (Basically: this syntax is a bit annoying on users but also very predictable and simple to implement, so it managed to gather consensus when more convenient and complex proposals did not.)
Some examples of syntaxes that have been considered in the process: let f = function type b. D ((x:b), f) -> f x
function D (type a) (x, f) -> f x (* using definition order for existential variables *)
let f (type b) (D ((x: b), f)) = ...
fun (C : type a b. a * (a -> b list) -> t. (x, f)) -> ...
fun (C (type a b) ((x : a), (f : a -> b list))) -> ...
function 'a. C ((x : 'a), f) -> ...
function <'a> Dyn (w,(x:'a)) -> ...
function Dyn (type a) (w, x : a ty * a) -> ...
function Dyn (type a) ((w : a ty), (x : a)) -> Generally:
|
Beta Was this translation helpful? Give feedback.
-
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Beta Was this translation helpful? Give feedback.
-
I am moving this feature wish to a discussion, since this is not really planned (and as far as I remember possibly much harder to implement that it looks). |
Beta Was this translation helpful? Give feedback.
-
Looks like I encountered this as well here.
To confirm: when using an inline-record rather than a tuple, there is no way to write that constraint, right? (I wouldn't know how to write a structural record annotation). |
Beta Was this translation helpful? Give feedback.
-
Currently, if we have this:
We will get an error:
This is the only correct way:
It would be nice if we could do this both ways.
Beta Was this translation helpful? Give feedback.
All reactions