monet / monet.js

monet.js - Monadic types library for JavaScript
https://monet.github.io/monet.js/
MIT License
1.6k stars 114 forks source link

Do notation implementation #236

Open apoberejnyi opened 3 years ago

apoberejnyi commented 3 years ago

There's a technique to emulate type-safe do notation using exceptions internally.

I've provided a summary with examples in the following article: https://apoberejnyi.medium.com/do-notation-for-either-in-typescript-c207e5987b7a. Functions from there can be implemented as static methods on the Either object.

Please take a look at whether such an approach fits the library design. If so, I will be happy to contribute at least to the Maybe and Either implementations.