missionary

2020-11-29T15:17:55.001900Z

Hi I noticed that missionary doesn't provide monad instances, is there a reason for that?

2020-11-29T16:05:37.005100Z

Mostly personal taste, I find coroutines more elegant in most situations. If you prefer monads, task has a natural monad implementation :

(defn task-unit [x] (m/sp x))
(defn task-bind [f task] (m/sp (m/? (f (m/? task)))))
flow is more subtle because there's at least 3 ways to implement bind :
(defn flow-unit [x] (m/ap x))
(defn flow-concat-bind [f flow] (m/ap (m/?? (f (m/?? flow)))))
(defn flow-switch-bind [f flow] (m/ap (m/?? (f (m/?! flow)))))
(defn flow-gather-bind [f flow] (m/ap (m/?? (f (m/?= flow)))))

2020-11-29T19:31:59.007200Z

Thank you, those hints are very helpful. Our reactive interpreter combines flow monad with state monad, i dont know any other good way to model it