Added "do notation" for Maybe, Either, Validation and IO Monads using generators#159
Added "do notation" for Maybe, Either, Validation and IO Monads using generators#159sevcsik wants to merge 6 commits intomonet:developfrom
Conversation
… generator functions used in new unit tests
|
You could use Babel to support phantomjs |
|
@graingert, I could, but I find it overkill to introduce a transpiler just to be able to run the unit tests. As PhantomJS has been abandoned, I think it makes more sense to switch to a headless browser. |
|
Sorry guys, don't have too much time lately… And what is most important from my point of view, this should be a separate library in I;ll bootstrap repository for it today/tomorrow ;) |
|
@sevcsik - sorry for horrible delay :( Are you still willing to contribute and make a standalone lib for |
|
@ulfryk I did a PoC for Maybe last year. TBH I don't remember how far I got. I didn't end up using Monet in any of my projects so I put this on the backburner. Here's what I got: https://github.com/sevcsik/monet-do/blob/master/src/index.ts If you see potential in it I'd be more than happy to continue. I'll write some tests to see if it works like the JS version. |
Added a generic
doNotationfunction, which is bound to monadsMaybe,Either,ValidationandIOas a staticdomethod. This will allow one to have a similar experience as Haskell'sdousing ES6 generators.Example:
The new library code itself doesn't require ES6, but the unit tests do, thus it was required to drop PhantomJS in favour of headless Chrome for unit tests (PhantomJS is abandoned anyway).
This PR doesn't include TypeScripy bindings yet, as it would require the
IterableIteratortype which would make thees6target mandatory.Fixes #103