From 992cb2f0d4e86827c9e9e65ec13f9d9c30dcad87 Mon Sep 17 00:00:00 2001 From: Marcin Puc Date: Mon, 11 Oct 2021 22:59:25 +0200 Subject: Rename list.head to list.first --- src/gleam/list.gleam | 8 ++++---- src/gleam/uri.gleam | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index a019653..e4063cd 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -163,16 +163,16 @@ pub fn contains(list: List(a), any elem: a) -> Bool { /// /// ## Examples /// -/// > head([]) +/// > first([]) /// Error(Nil) /// -/// > head([0]) +/// > first([0]) /// Ok(0) /// -/// > head([1, 2]) +/// > first([1, 2]) /// Ok(1) /// -pub fn head(list: List(a)) -> Result(a, Nil) { +pub fn first(list: List(a)) -> Result(a, Nil) { case list { [] -> Error(Nil) [x, .._] -> Ok(x) diff --git a/src/gleam/uri.gleam b/src/gleam/uri.gleam index 86e0c3a..b1d5ed1 100644 --- a/src/gleam/uri.gleam +++ b/src/gleam/uri.gleam @@ -116,7 +116,7 @@ if javascript { |> regex.compile(regex.Options(case_insensitive: True, multi_line: False)) |> result.nil_error |> result.map(regex.scan(_, string)) - |> result.then(list.head) + |> result.then(list.first) |> result.map(fn(m: regex.Match) { m.submatches }) |> result.unwrap([]) } -- cgit v1.2.3