Skip to content
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

Why do you use generators? #16

Open
vojtatranta opened this issue Apr 2, 2016 · 1 comment
Open

Why do you use generators? #16

vojtatranta opened this issue Apr 2, 2016 · 1 comment
Labels

Comments

@vojtatranta
Copy link
Contributor

Why do you use generators if they compile into while loops? Is it not too early to use them?
Have you encountered any troubles with that?

@tomkis
Copy link
Contributor

tomkis commented Apr 3, 2016

We are using Generators because it's great construct which allows us nicely yield side effects within functions while hypothetically maintaining their purity. Even Redux attempted to utilize something similar reduxjs/redux#1528

We haven't encountered any problems while using Generators. It does have a drawback though, you can't yield effects within callbacks unless you explicitly provide yield* in the Functor. So for example traditional map with yield will not work.

Generators are actually pretty mature, they successfully made it into ES2015 and therefore will get natively supported in browsers soon.

@tomkis tomkis added the question label Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants