Re:A generically typed pipe function in TypeScript
by harg on Monday August 08, 2022 @04:51AM
(#32383508)
I agree. This is what fp-ts's pipe[1] function does. It also has flow[2], which is basically a reversed compose.
[1]: https://gcanti.github.io/fp-ts/modules/function.ts.html#pipe
[2]: https://gcanti.github.io/fp-ts/modules/function.ts.html#flow
Re:A generically typed pipe function in TypeScript
by ledauphin on Sunday August 07, 2022 @08:21PM
(#32381252)
this pattern is standard in my experience for function composition. You're creating a function first, which can later be used to derive a result from an input.
Re:A generically typed pipe function in TypeScript
by sfvisser on Sunday August 07, 2022 @01:17PM
(#32378009)
Yes, more akin to what you’d normally call ‘compose’. Fun stuff nonetheless!
Re:A generically typed pipe function in TypeScript
by crooked-v on Sunday August 07, 2022 @07:17PM
(#32380871)
`compose` would actually imply
compose(fourth, third, second)(first)
You've gone from:
to when you could have done