aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2024-07-19 19:16:01 +0100
committerLouis Pilfold <louis@lpil.uk>2024-07-29 13:19:07 +0100
commit3840c2108415758df89e68e2f88d06a4cc878f9d (patch)
tree90b6ef31705ef0bb8d9b2a1d2b6262155cfce26b
parentc457ba2b4b7c60ef50f9fbbb4338ca41dfd7ee7e (diff)
downloadgleam_stdlib-3840c2108415758df89e68e2f88d06a4cc878f9d.tar.gz
gleam_stdlib-3840c2108415758df89e68e2f88d06a4cc878f9d.zip
apply functions
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/gleam/function.gleam31
2 files changed, 4 insertions, 29 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eabd6d1..4465cda 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
## Unreleased
-- The `function.curry*` functions have been deprecated.
+- The `function.curry*` and `function.apply*` functions have been deprecated.
- The deprecated `dynamic.unsafe_coerce` function has been removed.
- The deprecated `dict.update` function has been removed.
- The deprecated `order.max` and `order.min` functions have been removed.
diff --git a/src/gleam/function.gleam b/src/gleam/function.gleam
index 1178f1e..824f373 100644
--- a/src/gleam/function.gleam
+++ b/src/gleam/function.gleam
@@ -58,42 +58,17 @@ pub fn tap(arg: a, effect: fn(a) -> b) -> a {
arg
}
-/// Takes a function with arity one and an argument,
-/// calls that function with the argument and returns the function return value.
-///
-/// Useful for concisely calling functions returned as a part of a pipeline.
-///
-/// ## Example
-///
-/// ```gleam
-/// let doubler = fn() {
-/// fn(x: Int) { x * 2 }
-/// }
-///
-/// doubler() |> apply1(2)
-/// // -> 4
-/// ```
-///
+@deprecated("Use a fn literal instead, it is easier to understand")
pub fn apply1(fun: fn(a) -> value, arg1: a) -> value {
fun(arg1)
}
-/// Takes a function with arity two and two arguments,
-/// calls that function with the arguments
-/// and returns the function return value.
-///
-/// See [`apply1`](#apply1) for more details.
-///
+@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)
}
-/// Takes a function with arity three and three arguments,
-/// calls that function with the arguments
-/// and returns the function return value.
-///
-/// See [`apply1`](#apply1) for more details.
-///
+@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)
}