gcanti / fp-ts

Functional programming in TypeScript
https://gcanti.github.io/fp-ts/
MIT License
10.89k stars 503 forks source link

Backporting from effect/* #1851

Open gcanti opened 1 year ago

gcanti commented 1 year ago

The following features can be backported without breaking changes:

2.14

2.15

2.16

2.17

TODO (Feel free to add a comment to this issue if you want to suggest any other backporting)

sukovanej commented 1 year ago

What about these.

**tap***

**tapError** - there are TE.orElseFirstTaskK, TE.orElseFirstIOK and IOE.orElseFirstIOK, would it make sense to add remaining `tapError` combinators for types with errors?

gcanti commented 1 year ago

IMO it always makes sense since you get dual APIs and also a better name (tapError vs orElseFirst)

sukovanej commented 1 year ago

as and asUnit would be also nice, hm?

Does it make sense to implement as and asUnit for any data type having a functor instance or is there rule / law / practical reasoning for not having it for some data types? I see, in the effect/data, it's not implemented for arrays or Identity. What about State for example?

gcanti commented 1 year ago

No, there isn't a specific reason, they just don't seem very useful in the case of ReadonlyArray and Identity

sukovanej commented 1 year ago

Are struct and tuple from Product considered stable enough to be backported?

gcanti commented 1 year ago

Are struct and tuple from Product considered stable enough to be backported?

@sukovanej I think it's better to wait a little longer

p.s. Anything else you would like to add? otherwise we could release 2.16

sukovanej commented 1 year ago

Ok. I don't have anything right now.

christophgietl commented 1 year ago

How about tap for Identity? For me it feels a little bit awkward to write O.tap and I.chainFirst.

leighman commented 3 months ago

Don't know if you now want to introduce asVoid or whether unit remains the terminology in fp-ts?