Skip to content

How to do 'do-notation' with Monads in general? #459

Answered by Avaq
overflowz asked this question in Q&A
Discussion options

You must be logged in to vote

Currently do-notation only works for Future's. Is there any way to make it work with fantasy land spec monads?

There are general implementations of do-notation out there, for example fantasydo, fantasy-do, and do-notation. However, due to the mutable nature of generators in JavaScript, these implementations often cause problems when used with Futures that are forked more than once.

I'm not sure from your code example whether you want do-notation for Maybes specifically, or whether you want do-notation that can mix Maybes and Futures. In case of the former, one of the mentioned libraries will be exactly what you need.

In case of the latter, we will need to explore alternatives, as there …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Avaq
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #289 on January 22, 2021 11:27.