typescript-monads
typescript-monads copied to clipboard
AsncResult
Yes!
Planning on implementing this for Result and Maybe. I'm considering three possibilities:
- Altering the existing map method to check for promises and unwrap/wrap them appropriately
- Adding a separate method (aMap or mapAsync) which would be dedicated to the intended behavior
- 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.