Skip to content

Commit 6389ee5

Browse files
authored
Add ignore function to Stdlib modules where missing (#8060)
1 parent c8a9f0a commit 6389ee5

File tree

7 files changed

+31
-0
lines changed

7 files changed

+31
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#### :bug: Bug fix
2222

2323
- Rewatch: warnings for unsupported/unknown rescript.json fields. https://github.com/rescript-lang/rescript/pull/8031
24+
- Fix missing `ignore` function in some Stdlib modules. https://github.com/rescript-lang/rescript/pull/8060
2425

2526
#### :memo: Documentation
2627

packages/@rescript/runtime/Stdlib_ArrayBuffer.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ type t
1212
})
1313
@send
1414
external sliceToEnd: (t, ~start: int) => t = "slice"
15+
16+
external ignore: t => unit = "%ignore"

packages/@rescript/runtime/Stdlib_ArrayBuffer.resi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ ArrayBuffer.byteLength(sliced) == 8
5959
})
6060
@send
6161
external sliceToEnd: (t, ~start: int) => t = "slice"
62+
63+
/**
64+
`ignore(arrayBuffer)` ignores the provided arrayBuffer and returns unit.
65+
66+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
67+
without having to store or process it further.
68+
*/
69+
external ignore: t => unit = "%ignore"

packages/@rescript/runtime/Stdlib_Bool.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ let fromStringExn = fromStringOrThrow
3131
external compare: (bool, bool) => Stdlib_Ordering.t = "%compare"
3232

3333
external equal: (bool, bool) => bool = "%equal"
34+
35+
external ignore: bool => unit = "%ignore"

packages/@rescript/runtime/Stdlib_Bool.resi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,11 @@ Bool.equal(false, true) == false
9393
```
9494
*/
9595
external equal: (bool, bool) => bool = "%equal"
96+
97+
/**
98+
`ignore(bool)` ignores the provided boolean and returns unit.
99+
100+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
101+
without having to store or process it further.
102+
*/
103+
external ignore: bool => unit = "%ignore"

packages/@rescript/runtime/Stdlib_Lazy.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ let from_val = (type a, value: a): t<a> => {
105105
let make = from_fun
106106
let get = force
107107
let isEvaluated = is_val
108+
109+
external ignore: t<'a> => unit = "%ignore"

packages/@rescript/runtime/Stdlib_Lazy.resi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,11 @@ let from_val: 'a => t<'a>
125125
migrate: Lazy.isEvaluated(),
126126
})
127127
let is_val: t<'a> => bool
128+
129+
/**
130+
`ignore(lazyValue)` ignores the provided lazy value and returns unit.
131+
132+
This helper is useful when you want to discard a lazy value (for example, when only its side effects matter)
133+
without having to store or process it further.
134+
*/
135+
external ignore: t<'a> => unit = "%ignore"

0 commit comments

Comments
 (0)