forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPervasives_mini.res
91 lines (66 loc) · 2.7 KB
/
Pervasives_mini.res
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* Exceptions */
external raise: exn => 'a = "%raise"
/* Debugging */
external __LOC__: string = "%loc_LOC"
external __FILE__: string = "%loc_FILE"
external __LINE__: int = "%loc_LINE"
external __MODULE__: string = "%loc_MODULE"
external __POS__: (string, int, int, int) = "%loc_POS"
external __LOC_OF__: 'a => (string, 'a) = "%loc_LOC"
external __LINE_OF__: 'a => (int, 'a) = "%loc_LINE"
external __POS_OF__: 'a => ((string, int, int, int), 'a) = "%loc_POS"
/* Unified operations */
/*
Note:
Unified operations only work on `Pervasives`.
That means we can't rely on it when building stdlib until we remove the `Pervasives_mini`.
*/
external \"~+": int => int = "%identity"
external \"~-": int => int = "%negint"
external \"+": (int, int) => int = "%addint"
external \"-": (int, int) => int = "%subint"
external \"*": (int, int) => int = "%mulint"
external \"/": (int, int) => int = "%divint"
external \"%": (int, int) => int = "%modint"
external mod: (int, int) => int = "%modint"
/* Comparisons */
/* Note: Later comparisons will be converted to unified operations too */
external \"=": ('a, 'a) => bool = "%equal"
external \"<>": ('a, 'a) => bool = "%notequal"
external \"<": ('a, 'a) => bool = "%lessthan"
external \">": ('a, 'a) => bool = "%greaterthan"
external \"<=": ('a, 'a) => bool = "%lessequal"
external \">=": ('a, 'a) => bool = "%greaterequal"
external compare: ('a, 'a) => int = "%compare"
external min: ('a, 'a) => 'a = "%min"
external max: ('a, 'a) => 'a = "%max"
external \"==": ('a, 'a) => bool = "%eq"
external \"!=": ('a, 'a) => bool = "%noteq"
/* Boolean operations */
external not: bool => bool = "%boolnot"
external \"&&": (bool, bool) => bool = "%sequand"
external \"||": (bool, bool) => bool = "%sequor"
/* Integer operations */
external succ: int => int = "%succint"
external pred: int => int = "%predint"
external land: (int, int) => int = "%andint"
external lor: (int, int) => int = "%orint"
external lxor: (int, int) => int = "%xorint"
external lsl: (int, int) => int = "%lslint"
external lsr: (int, int) => int = "%lsrint"
external asr: (int, int) => int = "%asrint"
/* Floating-point operations */
external \"~-.": float => float = "%negfloat"
external \"~+.": float => float = "%identity"
external \"+.": (float, float) => float = "%addfloat"
external \"-.": (float, float) => float = "%subfloat"
external \"*.": (float, float) => float = "%mulfloat"
external \"/.": (float, float) => float = "%divfloat"
/* String operations */
external \"^": (string, string) => string = "%string_concat"
/* Unit operations */
external ignore: 'a => unit = "%ignore"
/* References */
type ref<'a> = {mutable contents: 'a}
external ref: 'a => ref<'a> = "%makeref"
external \":=": (ref<'a>, 'a) => unit = "%refset"