Think: f(fst:x, snd:y), what is the type of f(snd:4)?
I think this can be implemented, but then f(3, fst:5) is either an error or counter-intuitive.
Think: f(fst:x, snd:y), what is the type of f(snd:4)?
I think this can be implemented, but then f(3, fst:5) is either an error or counter-intuitive.
In practice the order and identity of the arguments is quite clear in Swift.
Is there a good intro to Swift that goes through only what is unique/peculiar about Swift and explains that in a good way to someone that already knows how to program?
# let f ~fst ~snd = fst + snd;;
val f : fst:int -> snd:int -> int = <fun>
# f ~snd:4;;
- : fst:int -> int = <fun>Without overloading you could define the answer as
g(x) { f(fst:x, snd:y) }
always which would make partial application somewhat ergonomic but makes allowing fst without snd horribly ugly when you have to pass in some spiritual null or _ to.I think these ideas are fundamentally opposed and so I don’t think there’s a good way to have a nice syntax for both.
f(fst = _, snd = y)The one largest obstacle for partial application (at least of the Haskell style) is optional arguments. You just can not have both.
But yeah, functors are all about building stuff like that. So there are similar things, just with a different syntax.