kleisli-validation 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kleisli/validation.rb +7 -3
- metadata +1 -1
data/lib/kleisli/validation.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
-
#require "kleisli/validation/version"
|
2
1
|
require "kleisli"
|
3
2
|
require "kleisli/semigroup_instances.rb"
|
4
3
|
|
5
4
|
module Kleisli
|
6
5
|
class Validation
|
7
|
-
VERSION = "0.0.
|
6
|
+
VERSION = "0.0.4"
|
8
7
|
|
9
8
|
class Success < Either::Right
|
10
9
|
|
11
10
|
def *(other)
|
12
11
|
if other.class == Success
|
13
|
-
|
12
|
+
self >-> f {
|
13
|
+
f = f.to_proc
|
14
|
+
other >-> val {
|
15
|
+
Success(f.arity > 1 ? f.curry.call(val) : f.call(val))
|
16
|
+
}
|
17
|
+
}
|
14
18
|
else
|
15
19
|
other
|
16
20
|
end
|