Open mstn opened 4 years ago
FWIW, I had myself a try at "fp-ts and Selective" some time ago
it could be useful for implementing Ramda-like conditionals even if probably goals are different from those in fp-ts-ramda.
I didn't look at the code in select-ts
yet, but if it is indeed an encoding of selective functors for fp-ts, it might be good to reimplement some related ramda functions in fp-ts-ramda
based on it
Hey @giogonzo I haven't seen your pr!
Yes, it is an encoding for selective functors in fp-ts
. As in the original paper, you can build one from a Monad (getSelectM
) or from an Applicative (missing). The execution semantics is different in the two cases.
For example, when is very Ramda-ish. You can find other Ramda-like operators in the project: cond
, unless
, ifElse
...
Imo also retry-ts can be rewritten using a selective functor. I have already implemented a while
operator, it shouldn't be much different.
📖 Documentation
I am building a package select-ts for
fp-ts
for behaviors of type "if this condition is true, then do that". It is based on:I think it could be useful for implementing Ramda-like conditionals even if probably goals are different from those in fp-ts-ramda.
It is still very experimental. What do you think? Does it make sense to you?