diff options
author | Louis Pilfold <louis@lpil.uk> | 2024-03-04 19:06:17 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-03-04 19:06:17 +0000 |
commit | 9747f89f82190778aad9768b1166abd3b6f91e09 (patch) | |
tree | 4efe6273ca98aebab81f61355a5d573eb9949308 /src | |
parent | 87c54cf8b12aed34578e4f919b6c8fa22edb2b8c (diff) | |
download | gleam_stdlib-9747f89f82190778aad9768b1166abd3b6f91e09.tar.gz gleam_stdlib-9747f89f82190778aad9768b1166abd3b6f91e09.zip |
Remove mismatch
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/list.gleam | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 8235d77..251c0bc 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -28,12 +28,6 @@ import gleam/order.{type Order} import gleam/pair import gleam/dict.{type Dict} -/// An error value returned by the `strict_zip` function. -/// -pub type LengthMismatch { - LengthMismatch -} - /// Counts the number of elements in a given list. /// /// This function has to traverse the list to determine the number of elements, @@ -1052,12 +1046,12 @@ pub fn zip(list: List(a), with other: List(b)) -> List(#(a, b)) { /// /// ```gleam /// strict_zip([1, 2], [3]) -/// // -> Error(LengthMismatch) +/// // -> Error(Nil) /// ``` /// /// ```gleam /// strict_zip([1], [3, 4]) -/// // -> Error(LengthMismatch) +/// // -> Error(Nil) /// ``` /// /// ```gleam @@ -1068,10 +1062,10 @@ pub fn zip(list: List(a), with other: List(b)) -> List(#(a, b)) { pub fn strict_zip( list: List(a), with other: List(b), -) -> Result(List(#(a, b)), LengthMismatch) { +) -> Result(List(#(a, b)), Nil) { case length(of: list) == length(of: other) { True -> Ok(zip(list, other)) - False -> Error(LengthMismatch) + False -> Error(Nil) } } |