aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Result.bruijn
diff options
context:
space:
mode:
Diffstat (limited to 'std/Result.bruijn')
-rw-r--r--std/Result.bruijn36
1 files changed, 18 insertions, 18 deletions
diff --git a/std/Result.bruijn b/std/Result.bruijn
index a8d830c..3e9960d 100644
--- a/std/Result.bruijn
+++ b/std/Result.bruijn
@@ -5,48 +5,48 @@
# encapsulates a value in ok
ok [[[1 2]]]
-:test ok [[0]] = [[1 [[0]]]]
+:test (ok [[0]]) ([[1 [[0]]]])
# encapsulates a value in err
err [[[0 2]]]
-:test err [[0]] = [[0 [[0]]]]
+:test (err [[0]]) ([[0 [[0]]]])
# checks whether result is ok
ok? [0 [T] [F]]
-:test ok? (ok [[0]]) = T
-:test ok? (err [[0]]) = F
+:test (ok? (ok [[0]])) (T)
+:test (ok? (err [[0]])) (F)
# checks whether result is not ok
err? [0 [F] [T]]
-:test err? (ok [[0]]) = F
-:test err? (err [[0]]) = T
+:test (err? (ok [[0]])) (F)
+:test (err? (err [[0]])) (T)
# encapsulates result ok value in a option
option-ok [0 some [none]]
-:test option-ok (ok [[0]]) = some [[0]]
-:test option-ok (err [[0]]) = none
+:test (option-ok (ok [[0]])) (some [[0]])
+:test (option-ok (err [[0]])) (none)
# encapsulate result err value in a option
option-err [0 [none] some]
-:test option-err (ok [[0]]) = none
-:test option-err (err [[0]]) = some [[0]]
+:test (option-err (ok [[0]])) (none)
+:test (option-err (err [[0]])) (some [[0]])
# extracts value from result or returns first arg
unwrap-or [[0 I [2]]]
-:test unwrap-or [[1]] (ok [[0]]) = [[0]]
-:test unwrap-or [[1]] (err [[0]]) = [[1]]
+:test (unwrap-or [[1]] (ok [[0]])) ([[0]])
+:test (unwrap-or [[1]] (err [[0]])) ([[1]])
# applies a function to the value in ok result
map [[0 [ok (2 0)] err]]
-:test map [[1]] (ok [[0]]) = ok [[[0]]]
-:test map [[1]] (err [[0]]) = err [[0]]
+:test (map [[1]] (ok [[0]])) (ok [[[0]]])
+:test (map [[1]] (err [[0]])) (err [[0]])
# applies a function to the value in err result
map-err [[0 ok [err (2 0)]]]
-:test map-err [[1]] (ok [[0]]) = (ok [[0]])
-:test map-err [[1]] (err [[0]]) = (err [[[0]]])
+:test (map-err [[1]] (ok [[0]])) ((ok [[0]]))
+:test (map-err [[1]] (err [[0]])) ((err [[[0]]]))
# applies encapsulated value to given function (if ok)
apply [[1 0 err]]
-:test apply (err [[0]]) [ok ([[1]] 0)] = err [[0]]
-:test apply (ok [[0]]) [ok ([[1]] 0)] = ok [[[0]]]
+:test (apply (err [[0]]) [ok ([[1]] 0)]) (err [[0]])
+:test (apply (ok [[0]]) [ok ([[1]] 0)]) (ok [[[0]]])