missionary
missionary copied to clipboard
`ap` cancellation doesn't propagate to child branches
Slack thread : https://clojurians.slack.com/archives/CL85MBPEF/p1726679710600169
Repro :
(def ps
((m/ap
(m/amb= 1 2 3)
(try (m/? m/never)
(catch missionary.Cancelled _
(m/amb))))
#(prn :step) #(prn :done)))
(ps) ;; should print :done
Does b40 fix this?
No, it's still a bug
Another possible example:
(defn with-final
[]
(m/ap
(m/amb=
:start
(try
(m/? m/never)
(catch missionary.Cancelled _ :end)))))
(defn merge-flows [& flows]
(m/ap
(m/?<
(m/?> (count flows) (m/seed flows)))))
(comment
(def cancel
((m/reduce prn nil (merge-flows (with-final)
(with-final))) prn prn))
(cancel) ;; prints end once
(cancel) ;; prints end again!
)
Thread: https://clojurians.slack.com/archives/CL85MBPEF/p1763154775780589?thread_ts=1763149125.436899&cid=CL85MBPEF