-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy patharity.re
62 lines (45 loc) · 1.14 KB
/
arity.re
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
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
/**
let u = obj => {
obj##hai(1, 2) ;
obj##hai(3, 4,2)
}
*/
// This function has arity2 but was expected arity3
/**
let u = obj => {
obj##hai(1, 2) ;
obj##hai("x",2)
}
*/
// This expression has type string but an expression was expected of type
/**
let u = obj => {
obj##hai(1, 2) ;
obj##hai(~x="x",2)
}
*/
// This function is applied to arguments
// This function is applied to arguments -- weird message
let h = u => {
let m = u##hi ;
m(.1,2);
}