typescript-monads icon indicating copy to clipboard operation
typescript-monads copied to clipboard

AsncResult

Open patrickmichalina opened this issue 4 years ago • 2 comments

patrickmichalina avatar May 14 '21 21:05 patrickmichalina

Yes!

colvint avatar May 17 '21 19:05 colvint

Planning on implementing this for Result and Maybe. I'm considering three possibilities:

  1. Altering the existing map method to check for promises and unwrap/wrap them appropriately
  2. Adding a separate method (aMap or mapAsync) which would be dedicated to the intended behavior
  3. Creating another class entirely in which each method accounts for async mappers and promises

Right off the bat, #3 seems like overkill. I believe #1 would be doable via overloaded method signatures without, for example, making every call result in a promise. And #2 would likely be the simplest. I'll be writing some test cases for the intended behavior and returning here.

ChrisHadar avatar Nov 26 '21 22:11 ChrisHadar