summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parser/index.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/parser/index.ts b/src/parser/index.ts
index d1da542..a2276bb 100644
--- a/src/parser/index.ts
+++ b/src/parser/index.ts
@@ -81,12 +81,11 @@ const unsignedNum: Parser<number> = mapTo(
)
const numberLiteral: Parser<Literal> = mapTo(
- pair(optional(oneOf(['+', '-'])), unsignedNum),
+ pair(optional(matchChar('-')), unsignedNum),
([signO, n]) =>
pipe(
signO,
- Option.getOrElse(() => '+'),
- sign => (sign === '-' ? -1 : 1) * n,
+ negative => (Option.isSome(negative) ? -1 : 1) * n,
Literal.Number,
),
)