aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2021-09-09 19:55:07 +0100
committerLouis Pilfold <louis@lpil.uk>2021-09-09 19:55:07 +0100
commitbc811f914387b05c34836b2be07697ae52ce6347 (patch)
tree2abb97f8a8e5b4acfb72362d6def1dd6c06ffcf5
parent014cf4a208b254d2172f318147edccc70fc1e49d (diff)
downloadgleam_stdlib-bc811f914387b05c34836b2be07697ae52ce6347.tar.gz
gleam_stdlib-bc811f914387b05c34836b2be07697ae52ce6347.zip
Remove dynamic thunk function
-rw-r--r--src/gleam/dynamic.gleam16
-rw-r--r--test/gleam/dynamic_test.gleam29
2 files changed, 0 insertions, 45 deletions
diff --git a/src/gleam/dynamic.gleam b/src/gleam/dynamic.gleam
index afea004..d4afca0 100644
--- a/src/gleam/dynamic.gleam
+++ b/src/gleam/dynamic.gleam
@@ -174,22 +174,6 @@ if erlang {
pub external fn bool(from: Dynamic) -> Result(Bool, DecodeError) =
"gleam_stdlib" "decode_bool"
- /// Checks to see whether a Dynamic value is a function that takes no arguments,
- /// and return the function if it is.
- ///
- /// ## Examples
- ///
- /// > import gleam/result
- /// > let f = fn() { 1 }
- /// > thunk(from(f)) |> result.is_ok
- /// True
- ///
- /// > thunk(from(123))
- /// Error(DecodeError(expected: "zero arity function", found: "Int"))
- ///
- pub external fn thunk(from: Dynamic) -> Result(fn() -> Dynamic, DecodeError) =
- "gleam_stdlib" "decode_thunk"
-
/// Checks to see whether a Dynamic value is a list, and return the list if it
/// is.
///
diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam
index 0d8dd09..3235fe6 100644
--- a/test/gleam/dynamic_test.gleam
+++ b/test/gleam/dynamic_test.gleam
@@ -130,35 +130,6 @@ if javascript {
}
if erlang {
- // TODO: remove
- pub fn thunk_test() {
- fn() { 1 }
- |> dynamic.from
- |> dynamic.thunk
- |> should.be_ok
-
- fn() { 1 }
- |> dynamic.from
- |> dynamic.thunk
- |> result.map(fn(f) { f() })
- |> should.equal(Ok(dynamic.from(1)))
-
- fn(x) { x }
- |> dynamic.from
- |> dynamic.thunk
- |> should.be_error
-
- 1
- |> dynamic.from
- |> dynamic.thunk
- |> should.be_error
-
- []
- |> dynamic.from
- |> dynamic.thunk
- |> should.be_error
- }
-
pub fn bool_test() {
True
|> dynamic.from