From 4b38d1af08288e80a29c84fe02a40ac925331f21 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 27 Nov 2024 15:16:11 +0100 Subject: Monad improvements --- std/Result.bruijn | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'std/Result.bruijn') diff --git a/std/Result.bruijn b/std/Result.bruijn index 51eabdc..f7e93f0 100644 --- a/std/Result.bruijn +++ b/std/Result.bruijn @@ -57,15 +57,10 @@ map-err [[0 ok [err (2 0)]]] ⧗ (a → b) → (Result a) → (Result b) :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]] ⧗ (Result a) → (a → b) → (Result b) - -:test (apply (err [[0]]) [ok ([[1]] 0)]) (err [[0]]) -:test (apply (ok [[0]]) [ok ([[1]] 0)]) (ok [[[0]]]) - pure ok ⧗ a → (Result a) -bind [[1 0 err]] ⧗ (Result a) → (a → (Result b)) → (Result a) +# applies encapsulated value to given function (if ok) +bind [[1 0 err]] ⧗ (Result a) → (a → (Result b)) → (Result b) …>>=… bind -- cgit v1.2.3