diff options
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)) } |