From 3eaf642b07b4dccf65f0b729c68ae798c4df5068 Mon Sep 17 00:00:00 2001 From: Nabeel Valley <36758308+nabeelvalley@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:49:57 +0200 Subject: [PATCH] :art: refactor map to use generics --- src/parz/combinators.gleam | 2 +- test/combinators_test.gleam | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parz/combinators.gleam b/src/parz/combinators.gleam index 19e45b5..b6556a8 100644 --- a/src/parz/combinators.gleam +++ b/src/parz/combinators.gleam @@ -150,7 +150,7 @@ pub fn map(parser: Parser(a), transform) { fn(input) { case parser(input) { Error(err) -> Error(err) - Ok(ok) -> Ok(#(transform(ok.matched), ok.remaining)) + Ok(ok) -> Ok(ParserState(transform(ok.matched), ok.remaining)) } } } diff --git a/test/combinators_test.gleam b/test/combinators_test.gleam index 8ef1421..c3ddb3d 100644 --- a/test/combinators_test.gleam +++ b/test/combinators_test.gleam @@ -195,11 +195,11 @@ pub fn map_test() { run(parser, "[hello]") |> should.be_ok - |> should.equal(#(Content("[hello]"), "")) + |> should.equal(ParserState(Content("[hello]"), "")) run(parser, "[hello]x") |> should.be_ok - |> should.equal(#(Content("[hello]"), "x")) + |> should.equal(ParserState(Content("[hello]"), "x")) run(parser, "[hellox") |> should.be_error