Skip to content

Commit 3eaf642

Browse files
committed
🎨 refactor map to use generics
1 parent 3652da3 commit 3eaf642

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/parz/combinators.gleam

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub fn map(parser: Parser(a), transform) {
150150
fn(input) {
151151
case parser(input) {
152152
Error(err) -> Error(err)
153-
Ok(ok) -> Ok(#(transform(ok.matched), ok.remaining))
153+
Ok(ok) -> Ok(ParserState(transform(ok.matched), ok.remaining))
154154
}
155155
}
156156
}

test/combinators_test.gleam

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ pub fn map_test() {
195195

196196
run(parser, "[hello]")
197197
|> should.be_ok
198-
|> should.equal(#(Content("[hello]"), ""))
198+
|> should.equal(ParserState(Content("[hello]"), ""))
199199

200200
run(parser, "[hello]x")
201201
|> should.be_ok
202-
|> should.equal(#(Content("[hello]"), "x"))
202+
|> should.equal(ParserState(Content("[hello]"), "x"))
203203

204204
run(parser, "[hellox")
205205
|> should.be_error

0 commit comments

Comments
 (0)