aboutsummaryrefslogtreecommitdiff
path: root/aoc-2020-gleam/src/days/day02.gleam
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2023-02-21 19:46:12 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2023-02-21 19:46:12 +0100
commit16509ecd4f31ef421a464a98c8e0ea73bb5cb111 (patch)
tree7ac2145ed18cf868abe0b877fecb5988d11fd2ac /aoc-2020-gleam/src/days/day02.gleam
parent9c94df2676e8b857eac6c94e827086bf0e8cb850 (diff)
downloadgleam_aoc2020-16509ecd4f31ef421a464a98c8e0ea73bb5cb111.tar.gz
gleam_aoc2020-16509ecd4f31ef421a464a98c8e0ea73bb5cb111.zip
Refactor previous days
Diffstat (limited to 'aoc-2020-gleam/src/days/day02.gleam')
-rw-r--r--aoc-2020-gleam/src/days/day02.gleam10
1 files changed, 5 insertions, 5 deletions
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