Skip to content

Commit 0beac42

Browse files
committed
fix unsafeTrace
1 parent 486c574 commit 0beac42

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/Control/Monad/Aff/Unsafe.purs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@ module Control.Monad.Aff.Unsafe where
33

44
foreign import unsafeTrace """
55
function unsafeTrace(v) {
6-
return function(error) {
7-
return function(success) {
8-
return function() {
9-
console.log(v);
6+
return function(success, error) {
7+
console.log(v);
108
11-
success({})();
12-
}
9+
try {
10+
success(v);
11+
} catch (e) {
12+
error(e);
1313
}
14-
}
14+
15+
var nonCanceler;
16+
17+
nonCanceler = function(e) {
18+
return function(sucess, error) {
19+
success(false);
20+
21+
return nonCanceler;
22+
}
23+
};
24+
25+
return nonCanceler;
26+
};
1527
}
1628
""" :: forall e a. a -> Aff e Unit
1729

0 commit comments

Comments
 (0)