forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharity.res
57 lines (47 loc) · 1.18 KB
/
arity.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
type t = (. ~x: int, ~y: int) => int
let u = (. ~f: t, a, b) => {
f(. ~x=a, ~y=b)->Js.log
f(. ~y=b, ~x=a)->Js.log
}
type t0 = (~x: int, ~y: int) => int
let u2 = (~f: t0, a, b) => {
f(~x=a, ~y=b)->Js.log
f(~y=b, ~x=a)->Js.log
}
let f = (. ~x, y) => x + y
let add = \"+"
// let u = f(.3,~x=2,1);
// This function has arity2 but was expected arity3
// let h = f (1, 2) ;
// This function has uncurried type, it needs to be applied in ucurried style
// This function has uncurried type, it needs to be applied in ucurried style
// let h = add(.1,2);
// This function is a curried function where an uncurried function is expected
@ocaml.doc("
let u = obj => {
obj##hai(1, 2) ;
obj##hai(3, 4,2)
}
")
@ocaml.doc("
let u = obj => {
obj##hai(1, 2) ;
obj##hai(\"x\",2)
}
")
@ocaml.doc("
let u = obj => {
obj##hai(1, 2) ;
obj##hai(~x=\"x\",2)
}
")
let // This function has arity2 but was expected arity3
// This expression has type string but an expression was expected of type
// This function is applied to arguments
// This function is applied to arguments -- weird message
h = u => {
let m = u["hi"]
m(. 1, 2)
}
//
let nested = ({"x": {"y": 3}}: {"x": {"y": int}})