4 ms·
I understand the hassle around pipelines. Entire ecosystems like `fp-ts` or `effect-ts` are regularly used with pipeable APIs and no one beats an eye. The onl
by epolanski 4y ago
I understand the hassle around pipelines.
Entire ecosystems like `fp-ts` or `effect-ts` are regularly used with pipeable APIs and no one beats an eye.
The only thing that was needed was a syntax that would've allowed this:
pipe(
"foo ",
capitalize, // "FOO "
trim, "FOO"
shout, "FOO!"
console.log, undefined
)
to not require `pipe`.
"foo "
|> capitalize
|> trim
|> shout
|> console.log
Why `pipe`? Because otherwise you need to write it like that:
`console.log(shout(trim(capitalize("foo"))))` which is unnatural as you need to read the chain in reverse order and is especially hard in less trivial cases than a sequential string manipulation.