Replies: 5 comments 1 reply
-
@ceuk thank you and so sorry for the delay! I at least am definitely interested (and would love to hear @bmakuh’s thoughts). I’d be happy to coordinate async here or to set up a sync discussion in chat or a video call sometime. |
Beta Was this translation helpful? Give feedback.
-
Oh wow very nice! @chriskrycho and I have talked about adding a Task before, but it's never happened. Just taking a glimpse, it does look pretty similar. Out of curiosity, could you describe your motivations for splitting apart Task and TaskEither? (And we've generally opted for the language of |
Beta Was this translation helpful? Give feedback.
-
Hi both, to answer some of the above: I went with the name Either because it's what I was already using, but I'm more than happy to adopt your nomenclature. Regarding my motivation for splitting In practice, the only thing I use it for currently is when I'm handling the response more-or-less straight away because it's easier and cleaner to call On @chriskrycho's point about synchronous coordination, it might be nice to have a chat about the current state of things etc as I imagine quite a few little things to cover and we could bash through them in a single call. What would your ideal next steps be? |
Beta Was this translation helpful? Give feedback.
-
Let's get something set up for sometime in April – feel free to email me at [email protected] and I'll get it set up! As a brief summary of my current thinking, in the meantime:
If that all sounds reasonable to you, let's get something going! |
Beta Was this translation helpful? Give feedback.
-
Sounds good to me! On the export function fromPromise <L, R> (promise: Promise<R>): TaskEither<L, R> {
return new TaskEither((resolve) => promise
.then((r: R) => resolve(Either.of(r)))
.catch((l: L) => resolve(left(l))))
} Would an optional second arg ( export function fromPromise <R, L = unknown> (promise: Promise<R>, onErr?: (err:unknown) => L): TaskEither<L, R> {
return new TaskEither((resolve) => promise
.then((r: R) => resolve(Either.of(r)))
.catch((l: L) => resolve(left(onErr ? onErr(l) : l))))
} Edit: (imagine Right = Ok and Left = Err) I'll drop you an email with some availability on April - this should be fun :) |
Beta Was this translation helpful? Give feedback.
-
Hi @chriskrycho, huge admirer of your (and the other contributors) work.
I've taken a load of your project structure, which is great and
copiedforked your Maybe class but added three others: Task, Either and TaskEither.I've literally just finished this second so it's still pretty early days and I don't plan to invest much in making the package usable by others, it's just got some stuff I wanted. They're much more lightweight than your two as well, as I've only focused on what I considered essential.
However, due to how similar these are in coding style and implementation I was wondering if you'd be interested in me drafting a PR around one or more of the additions? It wouldn't take too much work on my part. Got 100% test coverage, just need to add some doc-friendly comments and would have to potentially adapt task to use Result instead as that might make more sense. Plus whatever else you felt was needed.
Anywhoo, you can have a look here if you want to check it out. If you think there's something useful there let me know :)
Cheers
Beta Was this translation helpful? Give feedback.
All reactions