lalka 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lalka.rb +6 -7
  3. data/lib/lalka/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c89e1ae29d8f65245cab3ad0730a8b26087859c
4
- data.tar.gz: 05925e8d18a6850d9a5e52ca16306856c252a024
3
+ metadata.gz: 3d84e81df254853fab9f6098eb9977459e1ec950
4
+ data.tar.gz: cf66bc790e5914ae297f9b9adbc0ba60724e7bde
5
5
  SHA512:
6
- metadata.gz: 38462cfd7c7ad8218fe445cd3bf5ab8c50172cee6779bb5ff29533c12c095b27969faaaf5a8f853f20bac41d658dd2d19e09876b5f97a16806e35025c9508a03
7
- data.tar.gz: 76806c3b825c7cda3b42cbcf46f0a0068e78337ebce51be1678a5c60981110b06fdcc66cc493f00315bb67ef12a6d279c4fcbd92ad8bf53706bed2d7e95772c3
6
+ metadata.gz: a43f7bdad55186d6eee469b6a46b520d9f4a394359f3fdeabdfeef21dede608593495ebb014b4c9a9d4d9a9951603a21e0396dd6c77c9c3f77cd5331f78e249e
7
+ data.tar.gz: 0999a61f36c30400c6504ddb80b9c4b1197ba6f0e72731be8af9d9a2c1552b9743453ebb4b2d93786e46095b359120bf52c42053a0ac667819e85bac605b908c
@@ -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::Agent.new(M.Right(fn: M.None(), arg: M.None()))
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.send(fn) { |either, fn| either.bind { |struct| M.Right(struct.merge(fn: M.Some(fn))) } }
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.send(error) { |either, error| either.bind { M.Left(error) } }
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.send(arg) { |either, arg| either.bind { |struct| M.Right(struct.merge(arg: M.Some(arg))) } }
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.send(error) { |either, error| either.bind { M.Left(error) } }
137
+ atom.swap(error) { |either, error| either.bind { M.Left(error) } }
139
138
  end
140
139
  end
141
140
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Lalka
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
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.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-13 00:00:00.000000000 Z
11
+ date: 2016-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby