From 16509ecd4f31ef421a464a98c8e0ea73bb5cb111 Mon Sep 17 00:00:00 2001 From: Tomasz Chojnacki Date: Tue, 21 Feb 2023 19:46:12 +0100 Subject: Refactor previous days --- aoc-2020-gleam/src/days/day02.gleam | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'aoc-2020-gleam/src/days/day02.gleam') diff --git a/aoc-2020-gleam/src/days/day02.gleam b/aoc-2020-gleam/src/days/day02.gleam index bc8df7c..3f77384 100644 --- a/aoc-2020-gleam/src/days/day02.gleam +++ b/aoc-2020-gleam/src/days/day02.gleam @@ -18,15 +18,15 @@ type Line { fn parse_line(string: String) -> Line { let policy_parser = p.int() - |> p.then_skip(p.grapheme_literal("-")) + |> p.then_skip(p.literal("-")) |> p.then(p.int()) - |> p.then_skip(p.grapheme_literal(" ")) - |> p.then_third(p.any_grapheme()) - |> p.then_skip(p.string_literal(": ")) + |> p.then_skip(p.literal(" ")) + |> p.then_3rd(p.any_gc()) + |> p.then_skip(p.literal(": ")) |> p.map3(with: fn(min, max, grapheme) { Policy(min, max, grapheme) }) |> p.labeled(with: "policy") - let password_parser = p.labeled(p.any_string_greedy(), with: "password") + let password_parser = p.labeled(p.any_str_greedy(), with: "password") let line_parser = policy_parser -- cgit v1.2.3