From 484502213e65dbf9a80b7188f5b5af1d4354cf92 Mon Sep 17 00:00:00 2001 From: rowan Date: Wed, 16 Apr 2025 22:34:46 -0500 Subject: [PATCH] curry some functions. massaman or panang? --- src/cond.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cond.js b/src/cond.js index eaf063a..9cb2853 100644 --- a/src/cond.js +++ b/src/cond.js @@ -18,7 +18,7 @@ export const maybe = curry( return result.isOk() ? result : succeed([], original) }) -export const not = parser => state => { +export const not = curry((parser, state) => { const result = parser(state) if (result.isOk()) { @@ -26,13 +26,13 @@ export const not = parser => state => { } else { return succeed([], state) } -} +}) -export const until = parser => state => { +export const until = curry((parser, state) => { let result = ok(state) while (result.isOk()) { - const [original, clone] = fork(state) + const [original, clone] = result.chain(fork) result = result.chain(x => parser(clone)) if (result.isOk()) { break @@ -42,7 +42,7 @@ export const until = parser => state => { } return result -} +}) export const skip = curry((parser, state) => { })