-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathCreateInterface.res
145 lines (116 loc) · 2.33 KB
/
CreateInterface.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// ^int
type r = {name: string, age: int}
let add = (~x, ~y) => x + y
@react.component
let make = (~name) => React.string(name)
module Other = {
@react.component
let otherComponentName = (~name) => React.string(name)
}
module Mod = {
@react.component
let make = (~name) => React.string(name)
}
module type ModTyp = {
@react.component
let make: (~name: string) => React.element
}
@module("path") external dirname: string => string = "dirname"
@module("path") @variadic
external join: array<string> => string = "join"
@val
external padLeft: (
string,
@unwrap
[
| #Str(string)
| #Int(int)
],
) => string = "padLeft"
@inline
let f1 = 10
@inline let f2 = "some string"
@genType @inline
let f3 = 10
@genType @inline
let f4 = "some string"
@genType @inline let f5 = 5.5
module RFS = {
@module("fs")
external readFileSync: (
~name: string,
@string
[
| #utf8
| @as("ascii") #useAscii
],
) => string = "readFileSync"
}
module Functor = () => {
@react.component
let make = () => React.null
}
module type FT = {
module Functor: (
X: {
let a: int
@react.component
let make: (~name: string) => React.element
let b: int
},
Y: ModTyp,
) =>
{
@react.component
let make: (~name: string) => React.element
}
}
module NormaList = List
open Belt
module BeltList = List
module type MT2 = ModTyp
module rec RM: ModTyp = D
and D: ModTyp = Mod
module type OptT = {
@react.component
let withOpt1: (~x: int=?, ~y: int) => int
module type Opt2 = {
@react.component
let withOpt2: (~x: int=?, ~y: int) => int
}
module type Opt3 = {
@react.component
let withOpt3: (~x: option<int>, ~y: int) => int
}
}
module Opt = {
@react.component
let withOpt1 = (~x=3, ~y) => x + y
module Opt2 = {
@react.component
let withOpt2 = (~x: option<int>=?, ~y: int) =>
switch x {
| None => 0
| Some(x) => x
} +
y
}
module type Opt2 = module type of Opt2
module Opt3 = {
@react.component
let withOpt3 = (~x: option<int>, ~y: int) =>
switch x {
| None => 0
| Some(x) => x
} +
y
}
module type Opt3 = module type of Opt3
}
module Opt2: OptT = Opt
module Opt3 = Opt
module Memo = {
@react.component
let make = (~name) => React.string(name)
let make = React.memo(make)
}