-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Description
I'd like to explore an alternative to the partial application proposal that would only be used in conjunction with the pipeline operator.
There has been discussion around using ?
as a placeholder for functions with multiple arguments. Consider the readme example:
let person = { score: 25 };
let newScore = person.score
|> double
|> (_ => add(7, _))
|> (_ => boundScore(0, 100, _));
newScore //=> 57
If the ?
were to be built into the pipeline operator, we could rewrite the example to the following:
let newScore = person.score
|> double
|> add(7, ?)
|> boundScore(0, 100, ?);
and since this placeholder is scoped to the pipeline operator, it has the potential to be more expressive:
let ex1 = person |> double(?.score);
let ex2 = person.score |> add(?, ?);
and potentially allow member expressions?
let x = 10 |> f |> ?.foo |> g;
On the other hand, any sort of ?
placeholder might have people let write strange things like
x |> f(? ? ? : 10)
. Is this problematic?
davegregg, trustedtomato, jamen, kube, rauschma and 2 morecharmander
Metadata
Metadata
Assignees
Labels
No labels