diff options
author | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-02-22 13:34:58 +0100 |
---|---|---|
committer | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-02-22 13:34:58 +0100 |
commit | 5746dbca0ddaef455b6f26fba3945f3533d0b2c1 (patch) | |
tree | 855e48c9d25a0136351947dfe17140d40568e8fd /aoc-2020-gleam/src/util/input_util.gleam | |
parent | ed0763c9dce58a53715415f31146b6f670519d76 (diff) | |
download | gleam_aoc2020-5746dbca0ddaef455b6f26fba3945f3533d0b2c1.tar.gz gleam_aoc2020-5746dbca0ddaef455b6f26fba3945f3533d0b2c1.zip |
Add aliases to long imports
Diffstat (limited to 'aoc-2020-gleam/src/util/input_util.gleam')
-rw-r--r-- | aoc-2020-gleam/src/util/input_util.gleam | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/aoc-2020-gleam/src/util/input_util.gleam b/aoc-2020-gleam/src/util/input_util.gleam index fbe2d17..3ed2ce8 100644 --- a/aoc-2020-gleam/src/util/input_util.gleam +++ b/aoc-2020-gleam/src/util/input_util.gleam @@ -1,27 +1,27 @@ import gleam/int import gleam/list -import gleam/string -import gleam/function import gleam/bool +import gleam/string as str +import gleam/function as fun import gleam/erlang/file -import ext/resultx +import ext/resultx as resx pub fn read_text(filename: String) -> String { "data/" <> filename <> ".txt" |> file.read - |> resultx.force_unwrap + |> resx.assert_unwrap } pub fn read_lines(filename: String) -> List(String) { filename |> read_text - |> string.split(on: "\n") - |> list.map(with: string.trim) - |> list.filter(for: function.compose(string.is_empty, bool.negate)) + |> str.split(on: "\n") + |> list.map(with: str.trim) + |> list.filter(for: fun.compose(str.is_empty, bool.negate)) } pub fn read_numbers(filename: String) -> List(Int) { filename |> read_lines - |> list.map(with: function.compose(int.parse, resultx.force_unwrap)) + |> list.map(with: fun.compose(int.parse, resx.assert_unwrap)) } |