Skip to content

Commit e85f510

Browse files
committed
add a type t as an alias of the built-in type
1 parent 8ce22ce commit e85f510

15 files changed

+55
-0
lines changed

runtime/Array.res

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type t<'a> = array<'a>
2+
13
@new external makeUninitializedUnsafe: int => array<'a> = "Array"
24
@set external truncateToLengthUnsafe: (array<'a>, int) => unit = "length"
35
external getUnsafe: (array<'a>, int) => 'a = "%array_unsafe_get"

runtime/Array.resi

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/***
2+
A mutable array.
3+
4+
Compiles to a regular JavaScript array.*/
5+
6+
/**
7+
Type representing an array of value `'a`.
8+
*/
9+
type t<'a> = array<'a>
10+
111
/**
212
`fromIterator(iterator)`
313

runtime/BigInt.res

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
Type representing a bigint.
3+
*/
4+
type t = bigint
5+
16
@val external asIntN: (~width: int, bigint) => bigint = "BigInt.asIntN"
27
@val external asUintN: (~width: int, bigint) => bigint = "BigInt.asUintN"
38

runtime/Float.res

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type t = float
2+
13
module Constants = {
24
@val external nan: float = "NaN"
35
@val external epsilon: float = "Number.EPSILON"

runtime/Float.resi

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
Functions for interacting with float.
2727
*/
2828

29+
/**
30+
Type representing a float.
31+
*/
32+
type t = float
33+
2934
/**
3035
Float constants.
3136
*/

runtime/Int.res

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type t = int
2+
13
module Constants = {
24
@inline let minValue = -2147483648
35
@inline let maxValue = 2147483647

runtime/Int.resi

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ Functions for interacting with JavaScript Number.
2727
See: [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).
2828
*/
2929

30+
/**
31+
Type representing an int.
32+
*/
33+
type t = int
34+
35+
3036
module Constants: {
3137
/**
3238
The smallest positive number represented in JavaScript.

runtime/List.res

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161

6262
@@config({flags: ["-bs-noassertfalse"]})
6363

64+
type t<'a> = list<'a>
65+
6466
module A = {
6567
@new external makeUninitializedUnsafe: int => array<'a> = "Array"
6668
external min: ('a, 'a) => 'a = "%bs_min"

runtime/List.resi

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Collection functions for manipulating the `list` data structures, a singly-linke
3131
- Better interop with JavaScript
3232
- Better memory usage & performance.
3333
*/
34+
/**
35+
Type representing a list of value `'a`.
36+
*/
37+
type t<'a> = list<'a>
38+
3439
/**
3540
`length(list)` returns the length of `list`.
3641

runtime/Option.res

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24+
type t<'a> = option<'a>
2425

2526
let filter = (opt, p) =>
2627
switch opt {

runtime/Option.resi

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ let someString: option<string> = Some("hello")
3939
```
4040
*/
4141

42+
/**
43+
Type representing an option of type 'a.
44+
*/
45+
type t<'a> = option<'a>
46+
4247
/**
4348
`filter(opt, f)` applies `f` to `opt`, if `f` returns `true`, then it returns `Some(value)`, otherwise returns `None`.
4449

runtime/Result.res

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24+
type t<'res, 'err> = result<'res, 'err>
2425

2526
let getExn = x =>
2627
switch x {

runtime/Result.resi

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
}
4646
```
4747
*/
48+
type t<'res, 'err> = result<'res, 'err>
49+
4850
/**
4951
`getExn(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception
5052

runtime/String.res

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type t = string
2+
13
@val external make: 'a => string = "String"
24

35
@val external fromCharCode: int => string = "String.fromCharCode"

runtime/String.resi

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ Functions for interacting with JavaScript strings.
2727
See: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).
2828
*/
2929

30+
/**
31+
Type representing a string.
32+
*/
33+
type t = string
34+
3035
/**
3136
`make(value)` converts the given value to a `string`.
3237

0 commit comments

Comments
 (0)