lalka 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lalka.rb +6 -7
- data/lib/lalka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d84e81df254853fab9f6098eb9977459e1ec950
|
4
|
+
data.tar.gz: cf66bc790e5914ae297f9b9adbc0ba60724e7bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a43f7bdad55186d6eee469b6a46b520d9f4a394359f3fdeabdfeef21dede608593495ebb014b4c9a9d4d9a9951603a21e0396dd6c77c9c3f77cd5331f78e249e
|
7
|
+
data.tar.gz: 0999a61f36c30400c6504ddb80b9c4b1197ba6f0e72731be8af9d9a2c1552b9743453ebb4b2d93786e46095b359120bf52c42053a0ac667819e85bac605b908c
|
data/lib/lalka.rb
CHANGED
@@ -4,11 +4,10 @@ require 'dry-monads'
|
|
4
4
|
require 'concurrent'
|
5
5
|
|
6
6
|
module Lalka
|
7
|
+
M = Dry::Monads
|
7
8
|
# TODO: Invalidate resolve and reject at the same time
|
8
9
|
|
9
10
|
class Task
|
10
|
-
M = Dry::Monads
|
11
|
-
|
12
11
|
class << self
|
13
12
|
def resolve(value)
|
14
13
|
new do |t|
|
@@ -101,7 +100,7 @@ module Lalka
|
|
101
100
|
|
102
101
|
def ap(other_task)
|
103
102
|
Task.new do |t|
|
104
|
-
atom = Concurrent::
|
103
|
+
atom = Concurrent::Atom.new(M.Right(fn: M.None(), arg: M.None()))
|
105
104
|
|
106
105
|
atom.add_observer do |_, _, either|
|
107
106
|
if either.right?
|
@@ -121,21 +120,21 @@ module Lalka
|
|
121
120
|
|
122
121
|
fork do |this|
|
123
122
|
this.on_success do |fn|
|
124
|
-
atom.
|
123
|
+
atom.swap(fn) { |either, fn| either.bind { |struct| M.Right(struct.merge(fn: M.Some(fn))) } }
|
125
124
|
end
|
126
125
|
|
127
126
|
this.on_error do |error|
|
128
|
-
atom.
|
127
|
+
atom.swap(error) { |either, error| either.bind { M.Left(error) } }
|
129
128
|
end
|
130
129
|
end
|
131
130
|
|
132
131
|
other_task.fork do |other|
|
133
132
|
other.on_success do |arg|
|
134
|
-
atom.
|
133
|
+
atom.swap(arg) { |either, arg| either.bind { |struct| M.Right(struct.merge(arg: M.Some(arg))) } }
|
135
134
|
end
|
136
135
|
|
137
136
|
other.on_error do |error|
|
138
|
-
atom.
|
137
|
+
atom.swap(error) { |either, error| either.bind { M.Left(error) } }
|
139
138
|
end
|
140
139
|
end
|
141
140
|
end
|
data/lib/lalka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lalka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlad Shmyhlo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|