File tree Expand file tree Collapse file tree 4 files changed +36
-25
lines changed Expand file tree Collapse file tree 4 files changed +36
-25
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog #
2
2
3
+ ## Version 2.3.6
4
+
5
+ Date: 2020-04-07
6
+
7
+ - Bump Promesa version from 1.9.0 to 5.1.0
8
+
3
9
## Version 2.3.5
4
10
5
11
Date: 2020-02-21
Original file line number Diff line number Diff line change 1
- (defproject funcool /cats " 2.3.5 "
1
+ (defproject funcool /cats " 2.3.6 "
2
2
:description " Category Theory abstractions for Clojure"
3
3
:url " https://github.com/funcool/cats"
4
4
:license {:name " BSD (2 Clause)"
9
9
[org.clojure/test.check " 0.9.0" :scope " provided" ]
10
10
[org.clojure/core.match " 0.3.0-alpha4" :scope " provided" ]
11
11
[manifold " 0.1.6" :scope " provided" ]
12
- [funcool/promesa " 1.9 .0" :scope " provided" ]]
12
+ [funcool/promesa " 5.1 .0" :scope " provided" ]]
13
13
:deploy-repositories {" releases" :clojars
14
14
" snapshots" :clojars }
15
15
:source-paths [" src" ]
Original file line number Diff line number Diff line change 4
4
[cats.context :as mc]
5
5
[cats.protocols :as mp]
6
6
[promesa.core :as p]
7
+ [promesa.impl :as pi]
7
8
[promesa.protocols :as pp])
8
9
#? (:clj
9
10
(:import java.util.concurrent.CompletableFuture)))
10
11
11
12
(declare context )
12
13
13
- (extend-type #?(:cljs p/Promise :clj CompletableFuture)
14
- mp/Contextual
15
- (-get-context [_] context)
14
+ #?(:cljs
15
+ (defn extend-promise!
16
+ [t]
17
+ (extend-type t
18
+ mp/Contextual
19
+ (-get-context [_] context)
16
20
17
- mp/Extract
18
- (-extract [it]
19
- (pp/-extract it)))
21
+ mp/Extract
22
+ (-extract [it]
23
+ (pp/-extract it)))))
24
+
25
+ #?(:cljs (extend-promise! pi/*default-promise*))
26
+
27
+ #?(:clj
28
+ (extend-type CompletableFuture
29
+ mp/Contextual
30
+ (-get-context [_] context)
31
+
32
+ mp/Extract
33
+ (-extract [it]
34
+ (pp/-extract it))))
20
35
21
36
(def ^:no-doc context
22
37
(reify
29
44
(-bimap [_ err succ mv]
30
45
(-> mv
31
46
(pp/-map succ)
32
- (pp/-catch err)))
47
+ (pp/-thenErr err)))
33
48
34
49
mp/Monad
35
50
(-mreturn [_ v]
Original file line number Diff line number Diff line change 4
4
[cats.context :as ctx :include-macros true ]
5
5
[cats.core :as m :include-macros true ]
6
6
[cats.labs.promise :as pm]
7
- [promesa.core :as p])
7
+ [promesa.core :as p]
8
+ [promesa.impl :as pi]
9
+ [promesa.exec :as pe])
8
10
:clj (:require [clojure.test :as t]
9
11
[cats.builtin :as b]
10
12
[cats.context :as ctx]
11
13
[cats.core :as m]
12
14
[cats.labs.promise :as pm]
13
- [promesa.core :as p])))
15
+ [promesa.core :as p]
16
+ [promesa.exec :as pe])))
14
17
15
18
16
19
(defn future-ok
17
20
[sleep value]
18
- (p/promise (fn [resolve reject]
19
- (p/schedule sleep #(resolve value)))))
20
-
21
- (defn future-fail
22
- [sleep value]
23
- (p/promise (fn [_ reject]
24
- (p/schedule sleep #(reject value)))))
25
-
26
-
27
- #?(:cljs
28
- (t/deftest extract-from-rejected-promise
29
- (let [p1 (p/rejected 42 )]
30
- (t/is (p/rejected? p1))
31
- (t/is (= (p/extract p1) 42 )))))
21
+ (p/delay sleep value))
32
22
33
23
(t/deftest chaining-using-bind
34
24
#? (:cljs
You can’t perform that action at this time.
0 commit comments