I seem to have trouble understanding the semantics of named arguments. I thought that applying any named argument will take the argument from anywhere in the signature and eliminate it.
let full ~foo:_ ~bar:_ () = 1
(full ~bar:1);; - : foo:'a -> unit -> int = <fun>
So far so good.
I have this code which tries to partially apply
full but while
let curried f = f ~foo:1 let _ = (curried full) ~bar:2 ()
works, flipping the order
let curried f = f ~bar:1 let _ = (curried full) ~foo:2 ()
Error: This expression has type foo:'a -> bar:'b -> unit -> int but an expression was expected of type bar:int -> 'c
Thus my intuition that the order does not matter is not quite true. Can someone tell me where my intuition mislead me? For a moment I was excited that named arguments would allow partial application of any argument in any order.