curry some functions. massaman or panang?
This commit is contained in:
parent
628d0ef80b
commit
484502213e
1 changed files with 5 additions and 5 deletions
10
src/cond.js
10
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) => {
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue