aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcin Puc <marcin.e.puc@gmail.com>2021-10-11 22:59:25 +0200
committerLouis Pilfold <louis@lpil.uk>2021-10-12 20:54:39 +0100
commit992cb2f0d4e86827c9e9e65ec13f9d9c30dcad87 (patch)
treecdcd1b0d2c71fb6d9900aa0639c67cd7e020ad4b /src
parent357bbf83d8b1bf821f0a59cf563f18bf70573e50 (diff)
downloadgleam_stdlib-992cb2f0d4e86827c9e9e65ec13f9d9c30dcad87.tar.gz
gleam_stdlib-992cb2f0d4e86827c9e9e65ec13f9d9c30dcad87.zip
Rename list.head to list.first
Diffstat (limited to 'src')
-rw-r--r--src/gleam/list.gleam8
-rw-r--r--src/gleam/uri.gleam2
2 files changed, 5 insertions, 5 deletions
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([])
}