pelotom / burrido

Do-notation for JavaScript
MIT License
176 stars 2 forks source link

Typescript definitions #3

Open lukiano opened 7 years ago

lukiano commented 7 years ago

Not an issue per se, I was trying to do the same proof of concept as you did, but for TypeScript.

Wondering how could the generators work so well for Promises (async/await in TS transpiles into generators), but not for any object that has map/flatmap methods. So I encountered the need for cloneable generators, and when googled it, found your project!

Have you ever tried to check if this could work with types?

pelotom commented 7 years ago

Hi Lukiano, since monads require abstracting over type constructors I don't believe this library can be typed in a straightforward way until TypeScript gets support for higher-kinded types; see this issue. However it might be possible to do using this technique. I'd welcome a pull request if you'd like to give it a try!