samhh / fp-ts-std

The missing pseudo-standard library for fp-ts.
https://samhh.github.io/fp-ts-std/
MIT License
207 stars 27 forks source link

Conditional laziness #131

Closed samhh closed 2 years ago

samhh commented 2 years ago

The likes of pureIf and memptyWhen should probably take lazy values. Whilst they're usually used in lambdas with some laziness, they'd ideally delay computing the lifted value until the condition passes. It mightn't make sense for applicative when where it's for effectful computation.

samhh commented 2 years ago

https://github.com/samhh/fp-ts-std/commit/5c6bf4ebaacc24c7eb8fada27874f954ecf1ca34 & https://github.com/samhh/fp-ts-std/commit/6e2078c375c1b21d0b81e4152b6125e9aaa3d48d