Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ignore for every stdlib type t #7348

Merged
merged 3 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/es6/Stdlib.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


import * as Stdlib_Error from "./Stdlib_Error.js";
import * as Stdlib_Global from "./Stdlib_Global.js";
import * as Primitive_object from "./Primitive_object.js";

function assertEqual(a, b) {
Expand All @@ -18,6 +19,10 @@ function assertEqual(a, b) {
};
}

let TimeoutId = Stdlib_Global.TimeoutId;

let IntervalId = Stdlib_Global.IntervalId;

let $$Array;

let $$BigInt;
Expand Down Expand Up @@ -109,6 +114,8 @@ let $$BigUint64Array;
let panic = Stdlib_Error.panic;

export {
TimeoutId,
IntervalId,
$$Array,
$$BigInt,
Console,
Expand Down
13 changes: 12 additions & 1 deletion lib/es6/Stdlib_Global.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */



let TimeoutId = {};

let IntervalId = {};

export {
TimeoutId,
IntervalId,
}
/* No side effect */
7 changes: 7 additions & 0 deletions lib/js/Stdlib.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

let Stdlib_Error = require("./Stdlib_Error.js");
let Stdlib_Global = require("./Stdlib_Global.js");
let Primitive_object = require("./Primitive_object.js");

function assertEqual(a, b) {
Expand All @@ -18,6 +19,10 @@ function assertEqual(a, b) {
};
}

let TimeoutId = Stdlib_Global.TimeoutId;

let IntervalId = Stdlib_Global.IntervalId;

let $$Array;

let $$BigInt;
Expand Down Expand Up @@ -108,6 +113,8 @@ let $$BigUint64Array;

let panic = Stdlib_Error.panic;

exports.TimeoutId = TimeoutId;
exports.IntervalId = IntervalId;
exports.$$Array = $$Array;
exports.$$BigInt = $$BigInt;
exports.Console = Console;
Expand Down
11 changes: 10 additions & 1 deletion lib/js/Stdlib_Global.js
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
'use strict';


let TimeoutId = {};

let IntervalId = {};

exports.TimeoutId = TimeoutId;
exports.IntervalId = IntervalId;
/* No side effect */
2 changes: 2 additions & 0 deletions runtime/Stdlib_Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,5 @@ let findMap = (arr, f) => {
@send external at: (array<'a>, int) => option<'a> = "at"

let last = a => a->get(a->length - 1)

external ignore: array<'a> => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Array.resi
Original file line number Diff line number Diff line change
Expand Up @@ -1255,3 +1255,11 @@ Returns `None` if the array is empty.
```
*/
let last: array<'a> => option<'a>

/**
`ignore(array)` ignores the provided array 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: array<'a> => unit = "%ignore"
2 changes: 2 additions & 0 deletions runtime/Stdlib_AsyncIterator.res
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ let make: (unit => promise<value<'value>>) => t<'value> = %raw(`function makeAsy
}
}
}`)

external ignore: t<'a> => unit = "%ignore"
9 changes: 9 additions & 0 deletions runtime/Stdlib_AsyncIterator.resi
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,12 @@ main()->ignore
```
*/
let forEach: (t<'a>, option<'a> => unit) => promise<unit>

/**
`ignore(iterator)` ignores the provided async iterator 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<'a> => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_BigInt.res
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,11 @@ external lsl: (bigint, bigint) => bigint = "%lslbigint"
external asr: (bigint, bigint) => bigint = "%asrbigint"

let lnot = x => lxor(x, -1n)

/**
`ignore(bigint)` ignores the provided bigint 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: bigint => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_BigInt64Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "BigInt64Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigInt64Array.from"

/**
`ignore(bigIntArray)` ignores the provided bigIntArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_BigUint64Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "BigUint64Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigUint64Array.from"

/**
`ignore(bigUintArray)` ignores the provided bigUintArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_DataView.res
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ external fromBufferWithRange: (Stdlib_ArrayBuffer.t, ~byteOffset: int, ~length:

@send external setBigInt64: (t, int, bigint) => unit = "setBigInt64"
@send external setBigUint64: (t, int, bigint) => unit = "setBigUint64"

/**
`ignore(dataView)` ignores the provided dataView 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"
2 changes: 2 additions & 0 deletions runtime/Stdlib_Date.res
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,5 @@ external toLocaleTimeStringWithLocaleAndOptions: (t, string, localeOptions) => s
@send external toISOString: t => string = "toISOString"
@send external toUTCString: t => string = "toUTCString"
@return(nullable) @send external toJSON: t => option<string> = "toJSON"

external ignore: t => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Date.resi
Original file line number Diff line number Diff line change
Expand Up @@ -1358,3 +1358,11 @@ Date.fromString("")->Date.toJSON
@return(nullable)
@send
external toJSON: t => option<string> = "toJSON"

/**
`ignore(date)` ignores the provided date 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"
2 changes: 2 additions & 0 deletions runtime/Stdlib_Dict.res
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ let mapValues = (dict, f) => {
}

let has: (dict<'a>, string) => bool = %raw(`(dict, key) => key in dict`)

external ignore: dict<'a> => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Dict.resi
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,11 @@ dict->Dict.has("key3") // false
```
*/
let has: (dict<'a>, string) => bool

/**
`ignore(dict)` ignores the provided dict 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: dict<'a> => unit = "%ignore"
2 changes: 2 additions & 0 deletions runtime/Stdlib_Error.res
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ module URIError = {
external raise: t => 'a = "%raise"

let panic = msg => make(`Panic! ${msg}`)->raise

external ignore: t => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Error.resi
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,11 @@ try {
```
*/
let panic: string => 'a

/**
`ignore(error)` ignores the provided error 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"
2 changes: 2 additions & 0 deletions runtime/Stdlib_Exn.res
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ exception TypeError of error
The URIError object represents an error when a global URI handling function was used in a wrong way.
exception URIError of error
*/

external ignore: t => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Exn.resi
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ let raiseReferenceError: string => 'a
let raiseSyntaxError: string => 'a
let raiseTypeError: string => 'a
let raiseUriError: string => 'a

/**
`ignore(exn)` ignores the provided exn 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"
2 changes: 2 additions & 0 deletions runtime/Stdlib_Float.res
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ let clamp = (~min=?, ~max=?, value): float => {
| _ => value
}
}

external ignore: float => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Float.resi
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,11 @@ Float.clamp(4.2, ~min=4.3, ~max=4.1) == 4.3
```
*/
let clamp: (~min: float=?, ~max: float=?, float) => float

/**
`ignore(float)` ignores the provided float 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: float => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Float32Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Float32Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t = "Float32Array.from"

/**
`ignore(floatArray)` ignores the provided floatArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Float64Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Float64Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t = "Float64Array.from"

/**
`ignore(floatArray)` ignores the provided floatArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Global.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ type intervalId

@val external encodeURIComponent: string => string = "encodeURIComponent"
@val external decodeURIComponent: string => string = "decodeURIComponent"

module TimeoutId = {
external ignore: timeoutId => unit = "%ignore"
}

module IntervalId = {
external ignore: intervalId => unit = "%ignore"
}
20 changes: 20 additions & 0 deletions runtime/Stdlib_Global.resi
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,23 @@ Console.log(decodeURIComponent("array%3D%5BsomeValue%5D"))
*/
@val
external decodeURIComponent: string => string = "decodeURIComponent"

module TimeoutId: {
/**
`ignore(timeoutId)` ignores the provided timeoutId 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: timeoutId => unit = "%ignore"
}

module IntervalId: {
/**
`ignore(intervalId)` ignores the provided intervalId 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: intervalId => unit = "%ignore"
}
2 changes: 2 additions & 0 deletions runtime/Stdlib_Int.res
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ module Bitwise = {

let lnot = x => lxor(x, -1)
}

external ignore: int => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Int.resi
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,11 @@ module Bitwise: {
*/
external asr: (int, int) => int = "%asrint"
}

/**
`ignore(int)` ignores the provided int 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: int => unit = "%ignore"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Int16Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Int16Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t = "Int16Array.from"

/**
`ignore(intArray)` ignores the provided intArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Int32Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Int32Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t = "Int32Array.from"

/**
`ignore(intArray)` ignores the provided intArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Int8Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Int8Array.from"
*/
@val
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t = "Int8Array.from"

/**
`ignore(intArray)` ignores the provided intArray 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Intl_Collator.res
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ external supportedLocalesOf: (array<string>, ~options: supportedLocalesOptions=?
@send external resolvedOptions: t => resolvedOptions = "resolvedOptions"

@send external compare: (t, string, string) => int = "compare"

/**
`ignore(collator)` ignores the provided collator 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"
8 changes: 8 additions & 0 deletions runtime/Stdlib_Intl_DateTimeFormat.res
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,11 @@ external formatRangeToParts: (
~startDate: Stdlib_Date.t,
~endDate: Stdlib_Date.t,
) => array<dateTimeRangePart> = "formatRangeToParts"

/**
`ignore(dateTimeFormat)` ignores the provided dateTimeFormat 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"
Loading