leonoel / missionary

A functional effect and streaming system for Clojure/Script
Eclipse Public License 2.0
620 stars 25 forks source link

`m/sleep` does not terminate after exception #81

Open den1k opened 1 year ago

den1k commented 1 year ago

After executing the code below which is incorrect and throws an exception, m/sleep ceases to terminate in future evaluations

(m/? (m/ap
       (let [delay (m/?> ##Inf (m/seed [100]))]
         (m/? (m/sleep delay delay)))))

Exception in thread "missionary scheduler" clojure.lang.ArityException:
Wrong number of args (0) passed to: missionary.impl.Fiber/1/1/1
(m/? (m/sleep 100)) ;; deadlock
leonoel commented 1 year ago

One alternative could be to detect the user error earlier, in this case ? should be able to check that ap is not a task and raise an exception instead of trying to run it. See also #63