Skip to content

Commit 3ef4df1

Browse files
committed
Cleanup 2
1 parent df2e780 commit 3ef4df1

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

runtime/Primitive_lazy.res

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
@@config({flags: ["-bs-no-cross-module-opt"]})
2626

27-
type lazy_t<+'a>
27+
type t<+'a>
2828

2929
/* Internals of forcing lazy values. */
30-
type t<'a> = {
30+
type internal<'a> = {
3131
@as("LAZY_DONE") mutable tag: bool,
3232
/* Invariant: name */
3333
@as("VAL") mutable value: 'a,
@@ -36,15 +36,15 @@ type t<'a> = {
3636

3737
%%private(external fnToVal: (unit => 'a) => 'a = "%identity")
3838
%%private(external valToFn: 'a => unit => 'a = "%identity")
39-
%%private(external castToConcrete: lazy_t<'a> => t<'a> = "%identity")
40-
%%private(external castFromConcrete: t<'a> => lazy_t<'a> = "%identity")
39+
%%private(external castToConcrete: t<'a> => internal<'a> = "%identity")
40+
%%private(external castFromConcrete: internal<'a> => t<'a> = "%identity")
4141

42-
let is_val = (type a, l: lazy_t<a>): bool => castToConcrete(l).tag
42+
let is_val = (type a, l: t<a>): bool => castToConcrete(l).tag
4343

4444
exception Undefined
4545

4646
%%private(
47-
let forward_with_closure = (type a, blk: t<a>, closure: unit => a): a => {
47+
let forward_with_closure = (type a, blk: internal<a>, closure: unit => a): a => {
4848
let result = closure()
4949
blk.value = result
5050
blk.tag = true
@@ -56,7 +56,7 @@ exception Undefined
5656

5757
/* Assume [blk] is a block with tag lazy */
5858
%%private(
59-
let force_lazy_block = (type a, blk: t<a>): a => {
59+
let force_lazy_block = (type a, blk: internal<a>): a => {
6060
let closure = valToFn(blk.value)
6161
blk.value = fnToVal(raise_undefined)
6262
try forward_with_closure(blk, closure) catch {
@@ -69,40 +69,40 @@ exception Undefined
6969

7070
/* Assume [blk] is a block with tag lazy */
7171
%%private(
72-
let force_val_lazy_block = (type a, blk: t<a>): a => {
72+
let force_val_lazy_block = (type a, blk: internal<a>): a => {
7373
let closure = valToFn(blk.value)
7474
blk.value = fnToVal(raise_undefined)
7575
forward_with_closure(blk, closure)
7676
}
7777
)
7878

79-
let force = (type a, lzv: lazy_t<a>): a => {
80-
let lzv: t<_> = castToConcrete(lzv)
79+
let force = (type a, lzv: t<a>): a => {
80+
let lzv: internal<_> = castToConcrete(lzv)
8181
if lzv.tag {
8282
lzv.value
8383
} else {
8484
force_lazy_block(lzv)
8585
}
8686
}
8787

88-
let force_val = (type a, lzv: lazy_t<a>): a => {
89-
let lzv: t<_> = castToConcrete(lzv)
88+
let force_val = (type a, lzv: t<a>): a => {
89+
let lzv: internal<_> = castToConcrete(lzv)
9090
if lzv.tag {
9191
lzv.value
9292
} else {
9393
force_val_lazy_block(lzv)
9494
}
9595
}
9696

97-
let from_fun = (type a, closure: unit => a): lazy_t<a> => {
97+
let from_fun = (type a, closure: unit => a): t<a> => {
9898
let blk = {
9999
tag: false,
100100
value: fnToVal(closure),
101101
}
102102
castFromConcrete(blk)
103103
}
104104

105-
let from_val = (type a, value: a): lazy_t<a> => {
105+
let from_val = (type a, value: a): t<a> => {
106106
let blk = {
107107
tag: true,
108108
value,

runtime/Primitive_lazy.resi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
exception Undefined
22

3-
type lazy_t<+'a>
3+
type t<+'a>
44

55
/** [force x] forces the suspension [x] and returns its result.
66
If [x] has already been forced, [Lazy.force x] returns the
@@ -9,7 +9,7 @@ type lazy_t<+'a>
99
Raise {!Undefined} if the forcing of [x] tries to force [x] itself
1010
recursively.
1111
*/
12-
let force: lazy_t<'a> => 'a
12+
let force: t<'a> => 'a
1313

1414
/** [force_val x] forces the suspension [x] and returns its
1515
result. If [x] has already been forced, [force_val x]
@@ -19,23 +19,23 @@ let force: lazy_t<'a> => 'a
1919
If the computation of [x] raises an exception, it is unspecified
2020
whether [force_val x] raises the same exception or {!Undefined}.
2121
*/
22-
let force_val: lazy_t<'a> => 'a
22+
let force_val: t<'a> => 'a
2323

2424
/** [from_fun f] is the same as [lazy (f ())] but slightly more efficient.
2525
2626
[from_fun] should only be used if the function [f] is already defined.
2727
In particular it is always less efficient to write
2828
[from_fun (fun () => expr)] than [lazy expr].
2929
*/
30-
let from_fun: (unit => 'a) => lazy_t<'a>
30+
let from_fun: (unit => 'a) => t<'a>
3131

3232
/** [from_val v] returns an already-forced suspension of [v].
3333
This is for special purposes only and should not be confused with
3434
[lazy (v)].
3535
*/
36-
let from_val: 'a => lazy_t<'a>
36+
let from_val: 'a => t<'a>
3737

3838
/** [is_val x] returns [true] if [x] has already been forced and
3939
did not raise an exception.
4040
*/
41-
let is_val: lazy_t<'a> => bool
41+
let is_val: t<'a> => bool

runtime/Stdlib_Lazy.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type t<+'a> = Primitive_lazy.lazy_t<'a>
1+
type t<+'a> = Primitive_lazy.t<'a>
22

33
exception Undefined = Primitive_lazy.Undefined
44

0 commit comments

Comments
 (0)