diff --git a/CHANGELOG.md b/CHANGELOG.md index af8bdd9786..2bb3241c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ #### :bug: Bug fix - Rewatch: warnings for unsupported/unknown rescript.json fields. https://github.com/rescript-lang/rescript/pull/8031 +- Fix missing `ignore` function in some Stdlib modules. https://github.com/rescript-lang/rescript/pull/8060 #### :memo: Documentation diff --git a/packages/@rescript/runtime/Stdlib_ArrayBuffer.res b/packages/@rescript/runtime/Stdlib_ArrayBuffer.res index df14c7f193..4983aff64d 100644 --- a/packages/@rescript/runtime/Stdlib_ArrayBuffer.res +++ b/packages/@rescript/runtime/Stdlib_ArrayBuffer.res @@ -12,3 +12,5 @@ type t }) @send external sliceToEnd: (t, ~start: int) => t = "slice" + +external ignore: t => unit = "%ignore" diff --git a/packages/@rescript/runtime/Stdlib_ArrayBuffer.resi b/packages/@rescript/runtime/Stdlib_ArrayBuffer.resi index fb9a467a8e..e74dd6667f 100644 --- a/packages/@rescript/runtime/Stdlib_ArrayBuffer.resi +++ b/packages/@rescript/runtime/Stdlib_ArrayBuffer.resi @@ -59,3 +59,11 @@ ArrayBuffer.byteLength(sliced) == 8 }) @send external sliceToEnd: (t, ~start: int) => t = "slice" + +/** + `ignore(arrayBuffer)` ignores the provided arrayBuffer and returns unit. + + This helper is useful when you want to discard a value (for example, the result of an operation with side effects) + without having to store or process it further. +*/ +external ignore: t => unit = "%ignore" diff --git a/packages/@rescript/runtime/Stdlib_Bool.res b/packages/@rescript/runtime/Stdlib_Bool.res index 3785d3f25e..5120e5229e 100644 --- a/packages/@rescript/runtime/Stdlib_Bool.res +++ b/packages/@rescript/runtime/Stdlib_Bool.res @@ -31,3 +31,5 @@ let fromStringExn = fromStringOrThrow external compare: (bool, bool) => Stdlib_Ordering.t = "%compare" external equal: (bool, bool) => bool = "%equal" + +external ignore: bool => unit = "%ignore" diff --git a/packages/@rescript/runtime/Stdlib_Bool.resi b/packages/@rescript/runtime/Stdlib_Bool.resi index 7f3408e504..0bd7bb209e 100644 --- a/packages/@rescript/runtime/Stdlib_Bool.resi +++ b/packages/@rescript/runtime/Stdlib_Bool.resi @@ -93,3 +93,11 @@ Bool.equal(false, true) == false ``` */ external equal: (bool, bool) => bool = "%equal" + +/** + `ignore(bool)` ignores the provided boolean and returns unit. + + This helper is useful when you want to discard a value (for example, the result of an operation with side effects) + without having to store or process it further. +*/ +external ignore: bool => unit = "%ignore" diff --git a/packages/@rescript/runtime/Stdlib_Lazy.res b/packages/@rescript/runtime/Stdlib_Lazy.res index 084241c967..681e5edc74 100644 --- a/packages/@rescript/runtime/Stdlib_Lazy.res +++ b/packages/@rescript/runtime/Stdlib_Lazy.res @@ -105,3 +105,5 @@ let from_val = (type a, value: a): t => { let make = from_fun let get = force let isEvaluated = is_val + +external ignore: t<'a> => unit = "%ignore" diff --git a/packages/@rescript/runtime/Stdlib_Lazy.resi b/packages/@rescript/runtime/Stdlib_Lazy.resi index 9098977f5a..e5d5a93089 100644 --- a/packages/@rescript/runtime/Stdlib_Lazy.resi +++ b/packages/@rescript/runtime/Stdlib_Lazy.resi @@ -125,3 +125,11 @@ let from_val: 'a => t<'a> migrate: Lazy.isEvaluated(), }) let is_val: t<'a> => bool + +/** + `ignore(lazyValue)` ignores the provided lazy value and returns unit. + + This helper is useful when you want to discard a lazy value (for example, when only its side effects matter) + without having to store or process it further. +*/ +external ignore: t<'a> => unit = "%ignore"