-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added "do notation" for Maybe, Either, Validation and IO Monads using generators #159
base: develop
Are you sure you want to change the base?
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
doNotation
function, which is bound to monadsMaybe
,Either
,Validation
andIO
as a staticdo
method. This will allow one to have a similar experience as Haskell'sdo
using 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
IterableIterator
type which would make thees6
target mandatory.Fixes #103