|
|
|
|
|
by porridgeraisin
416 days ago
|
|
Correct me if I'm wrong, but if you use the below syntax "bar"
|> await getFuture()
How would you disambiguate it from your intended meaning and the below: "bar"
|> await getFutureAsyncFactory()
Basically, an async function that returns a function which is intended to be the pipeline processor.Typically in JS you do this with parens like so: (await getFutureAsyncFactory())("input") But the use of parens doesn't transpose to the pipeline setting well IMO |
|
Given this example:
the getFutureAsyncFactory function is async, but the function it returns is not (or it may be and we just don't await it). Basically, using |> like you stated above doesn't do what you want. If you wanted the same semantics, you would have to do something like: to invoke the returned function.The whole pipeline takes on the value of the last function specified.