ts-failable
ts-failable copied to clipboard
Generalizing the framework
Thanks for the wonderful library!
Would you consider generalizing this beyond error-handling and and threading any monadic context?
I had written something similar for Optional types. Such that you can do (using your syntax):
const key = run(user.username);
const value = run(map.get(key));
// etc.
I thought at least Optional made sense for your library since it already includes related work (deprecated by existential chaining).
Not sure if it is possible to generalize this to all monads in a type-safe way because that would require higher kinded types, which typescript doesn't have. Keeping this open but I highly doubt if this is possible.