Syntax for empty lambda abstraction with named parameters.
#263 opened on Oct 27, 2025
Repository metrics
- Stars
- (46 stars)
- PR merge metrics
- (PR metrics pending)
Description
Currently, there is a semantic difference between implicit and explicit abstraction of implicit parameters when higher-order function is called. When all named parameters are omitted, all implicit parameters are introduced to the environment, while when some named parameters are abstracted, only explicitly abstracted parameters are introduced. For instance, consider the following code.
let foo {~n} (f : {~n, x} -> Unit ->> _) =
f (fn () => ~n); # ~n refers to the implicit parameter of a lambda
f (fn {~n} => ~n); # same as above, but stated explicitly
f (fn {x} => ~n); # ~n refers to parameter of foo
()
I'm still not sure if this behavior is the right one, but if we do so, it might be useful to mark lambda abstraction as explicitly taking named parameters to enforce the latter behavior, but naming none of them, like f (fn {} => ~n). The implementation of the type-checker can handle that (PF_Fn constructor can take empty list), so only the parser should be updated.