fp-ts
fp-ts copied to clipboard
pipe and bracket
🚀 Feature request
Current Behavior
Currently, bracket's signature is (acquire, use, release) => { ... }
Desired Behavior
Looking at https://wiki.haskell.org/Bracket_pattern, the signature there is (acquire) => (release) => (use) => { ... }. That appears to be more easily pipeable and avoids having the annotate the type of use.
Suggested Solution
Please consider a breaking change as a part of your 3.0 work to the more Haskell-like signature.
Your environment
Software | Version(s) |
---|---|
fp-ts | 2.11.7 |
TypeScript | 4.5.4 |
By how TS inference work the only pipeable would be: (use, release) => (acquire) => ... to be used like pipe(doBla, blaBla, bracket(use, release))
That's because release
needs the types from use
and acquire
while use
only needs (but still needs) the types from acquire
.