Closed eduhenke closed 3 years ago
You suggest that I use (await eitherAsync.bimap<T, T>(f, g)).extract()
? I haven't thought of that, but that would maybe be a nice addition to EitherAsync
to make it look more like Either
that would maybe be a nice addition to EitherAsync
It's already in EitherAsync
:)
You can also do
const result = (await eitherAsync).either(onLeft, onRight)
There are a lot of ways to achieve this result, there's no specific reason why there is no EitherAsync#either
, but if enough people find it useful I'll implement it.
If you want, I can see other similar functions that could be implemented in EitherAsync
, and submit a PR implementing them aswell.
You can create issues about functions that you think would be useful, that's good enough. If you spend time implementing something and I don't see it as a good fit for the library and reject your PR you would've just wasted your time.
Is the
Either#either
function possible to implement inEitherAsync
? Because right now we don't have any way to fold both sides to a third type, i.e.<T>(onLeft: L => T, onRight: R => T): Promise<T>
I've seen that the Either functionality was merged into EitherAsync in #247, but it seems to be missing this.