-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Context
'Promise' return values are non-trivial to spec: derefing them on :post would make that defn blocking, defeating the purpose of promises
Task
Implement speced/promise (a promise replacement), plus speced/promise-of(a spec predicate)
Example:
(defn promise [spec]
(let [p (clojure.core/promise)]
(fn [deliverable]
(assert (check! spec deliverable))
(deliver p deliverable))))
(spec/valid? (speced/promise-of ::foo) (speced/promise ::foo)) ;; trueAcceptance criteria
- Works analogously to clojure.core/promise
- The resulting spec checking is meaningful / strong