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/Monad/Parser.bruijn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'std/Monad/Parser.bruijn') diff --git a/std/Monad/Parser.bruijn b/std/Monad/Parser.bruijn index 0364ea0..12c058f 100644 --- a/std/Monad/Parser.bruijn +++ b/std/Monad/Parser.bruijn @@ -38,7 +38,7 @@ fail [[R.err 1]] ⧗ a → (Parser a) pure [[R.ok (1 : 0)]] ⧗ a → (Parser a) -ap [[[R.apply (2 0) ok]]] ⧗ (Parser (a → b)) → (Parser a) → (Parser b) +ap [[[R.bind (2 0) ok]]] ⧗ (Parser (a → b)) → (Parser a) → (Parser b) ok &[[R.map ok (3 0)]] ok &[[(3 1) : 0]] @@ -52,14 +52,14 @@ string y [[0 [[[go]]] (pure [[0]])]] ⧗ String → (Parser a) return pure ⧗ a → (Parser a) -bind [[[R.apply (2 0) ok]]] ⧗ (Parser a) → (a → (Parser b)) → (Parser a) +bind [[[R.bind (2 0) ok]]] ⧗ (Parser a) → (a → (Parser b)) → (Parser a) ok &[[3 1 0]] …>>=… bind alt [[[2 0 R.ok err]]] ⧗ (Parser a) → (Parser a) → (Parser a) err [2 1 R.ok err] - err [R.err (error-compose 1 0)] + err R.err ∘ (error-compose 0) …<|>… alt -- cgit v1.2.3