aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/gleam/dynamic.gleam10
2 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 469aede..d186c98 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## Unreleased
+- The `dynamic` module gains the `dynamic` function.
- The `dynamic.list` function has been renamed to `dynamic.shallow_list`.
- The `dynamic.typed_list` function has been renamed to `dynamic.list`.
- The `dynamic.result` function has been removed.
diff --git a/src/gleam/dynamic.gleam b/src/gleam/dynamic.gleam
index 1d8e9ff..30a297c 100644
--- a/src/gleam/dynamic.gleam
+++ b/src/gleam/dynamic.gleam
@@ -58,6 +58,16 @@ if javascript {
"../gleam_stdlib.mjs" "identity"
}
+/// Converts a `Dynamic` value into a `Dynamic` value.
+///
+/// This function doesn't seem very useful at first, but it can be convenient
+/// when you need to give a decoder function but you don't actually care what
+/// the to-decode value is.
+///
+pub fn dynamic(term: Dynamic) -> Dynamic {
+ unsafe_coerce(term)
+}
+
/// Checks to see whether a `Dynamic` value is a bit_string, and returns that bit string if
/// it is.
///