diff options
author | Louis Pilfold <louis@lpil.uk> | 2025-01-03 20:54:32 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2025-01-03 20:57:01 +0000 |
commit | c5d0edeaf6edd3280883497d931bdae8aa88afa5 (patch) | |
tree | 8e62f05faa7af33d5d7e61846eef716feab25e38 /src | |
parent | ced490f266237ee97420d8a63f541c6ebcb92035 (diff) | |
download | gleam_stdlib-c5d0edeaf6edd3280883497d931bdae8aa88afa5.tar.gz gleam_stdlib-c5d0edeaf6edd3280883497d931bdae8aa88afa5.zip |
Remove deprecated
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/bool.gleam | 20 | ||||
-rw-r--r-- | src/gleam/function.gleam | 52 | ||||
-rw-r--r-- | src/gleam/list.gleam | 22 | ||||
-rw-r--r-- | src/gleam/result.gleam | 19 |
4 files changed, 3 insertions, 110 deletions
diff --git a/src/gleam/bool.gleam b/src/gleam/bool.gleam index 6c14d68..26a6ac4 100644 --- a/src/gleam/bool.gleam +++ b/src/gleam/bool.gleam @@ -6,8 +6,6 @@ //// field consider having a `role: SchoolRole` field where `SchoolRole` is a custom //// type that can be either `Student` or `Teacher`. -import gleam/order.{type Order} - /// Returns the and of two bools, but it evaluates both arguments. /// /// It's the function equivalent of the `&&` operator. @@ -192,24 +190,6 @@ pub fn exclusive_nor(a: Bool, b: Bool) -> Bool { a == b } -@deprecated("Please use a case expression to get the behaviour you desire") -pub fn compare(a: Bool, with b: Bool) -> Order { - case a, b { - True, True -> order.Eq - True, False -> order.Gt - False, False -> order.Eq - False, True -> order.Lt - } -} - -@deprecated("Please use a case expression to get the behaviour you desire") -pub fn to_int(bool: Bool) -> Int { - case bool { - False -> 0 - True -> 1 - } -} - /// Returns a string representation of the given bool. /// /// ## Examples diff --git a/src/gleam/function.gleam b/src/gleam/function.gleam index 824f373..8c2a571 100644 --- a/src/gleam/function.gleam +++ b/src/gleam/function.gleam @@ -1,35 +1,3 @@ -@deprecated("Use a fn literal instead, it is easier to understand") -pub fn compose(fun1: fn(a) -> b, fun2: fn(b) -> c) -> fn(a) -> c { - fn(a) { fun2(fun1(a)) } -} - -@deprecated("Use the anonymous function syntax instead") -pub fn curry2(fun: fn(a, b) -> value) { - fn(a) { fn(b) { fun(a, b) } } -} - -@deprecated("Use the anonymous function syntax instead") -pub fn curry3(fun: fn(a, b, c) -> value) { - fn(a) { fn(b) { fn(c) { fun(a, b, c) } } } -} - -@deprecated("Use the anonymous function syntax instead") -pub fn curry4(fun: fn(a, b, c, d) -> value) { - fn(a) { fn(b) { fn(c) { fn(d) { fun(a, b, c, d) } } } } -} - -@deprecated("Use the anonymous function syntax instead") -pub fn curry5(fun: fn(a, b, c, d, e) -> value) { - fn(a) { fn(b) { fn(c) { fn(d) { fn(e) { fun(a, b, c, d, e) } } } } } -} - -@deprecated("Use the anonymous function syntax instead") -pub fn curry6(fun: fn(a, b, c, d, e, f) -> value) { - fn(a) { - fn(b) { fn(c) { fn(d) { fn(e) { fn(f) { fun(a, b, c, d, e, f) } } } } } - } -} - /// Takes a function that takes two arguments and returns a new function that /// takes the same two arguments, but in reverse order. /// @@ -43,11 +11,6 @@ pub fn identity(x: a) -> a { x } -@deprecated("Use a fn literal instead, it is easier to understand") -pub fn constant(value: a) -> fn(b) -> a { - fn(_) { value } -} - /// Takes an argument and a single function, /// calls that function with that argument /// and returns that argument instead of the function return value. @@ -57,18 +20,3 @@ pub fn tap(arg: a, effect: fn(a) -> b) -> a { effect(arg) arg } - -@deprecated("Use a fn literal instead, it is easier to understand") -pub fn apply1(fun: fn(a) -> value, arg1: a) -> value { - fun(arg1) -} - -@deprecated("Use a fn literal instead, it is easier to understand") -pub fn apply2(fun: fn(a, b) -> value, arg1: a, arg2: b) -> value { - fun(arg1, arg2) -} - -@deprecated("Use a fn literal instead, it is easier to understand") -pub fn apply3(fun: fn(a, b, c) -> value, arg1: a, arg2: b, arg3: c) -> value { - fun(arg1, arg2, arg3) -} diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index c4211f8..b3ab350 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -679,27 +679,11 @@ fn reverse_and_prepend(list prefix: List(a), to suffix: List(a)) -> List(a) { } } -/// Joins a list of lists into a single list. -/// -/// This function traverses all elements twice. -/// -/// ## Examples -/// -/// ```gleam -/// concat([[1], [2, 3], []]) -/// // -> [1, 2, 3] -/// ``` -/// -@deprecated("Use `list.flatten` instead.") -pub fn concat(lists: List(List(a))) -> List(a) { - concat_loop(lists, []) -} - -fn concat_loop(lists: List(List(a)), acc: List(a)) -> List(a) { +fn flatten_loop(lists: List(List(a)), acc: List(a)) -> List(a) { case lists { [] -> reverse(acc) [list, ..further_lists] -> - concat_loop(further_lists, reverse_and_prepend(list: list, to: acc)) + flatten_loop(further_lists, reverse_and_prepend(list: list, to: acc)) } } @@ -716,7 +700,7 @@ fn concat_loop(lists: List(List(a)), acc: List(a)) -> List(a) { /// ``` /// pub fn flatten(lists: List(List(a))) -> List(a) { - concat_loop(lists, []) + flatten_loop(lists, []) } /// Maps the list with the given function into a list of lists, and then flattens it. diff --git a/src/gleam/result.gleam b/src/gleam/result.gleam index 0911f26..9e00082 100644 --- a/src/gleam/result.gleam +++ b/src/gleam/result.gleam @@ -262,25 +262,6 @@ pub fn unwrap_both(result: Result(a, a)) -> a { } } -/// Transforms any error into `Error(Nil)`. -/// -/// ## Examples -/// -/// ```gleam -/// nil_error(Error(1)) -/// // -> Error(Nil) -/// ``` -/// -/// ```gleam -/// nil_error(Ok(1)) -/// // -> Ok(1) -/// ``` -/// -@deprecated("Use `result.replace_error` with the `Nil` value instead") -pub fn nil_error(result: Result(a, e)) -> Result(a, Nil) { - replace_error(result, Nil) -} - /// Returns the first value if it is `Ok`, otherwise returns the second value. /// /// ## Examples |