-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathregular.fs
112 lines (85 loc) · 1.98 KB
/
regular.fs
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
module Regular
let no_args () =
()
let one_arg (x: int) =
x
let two_args (x: int) (y: int) =
x + y
let three_args (x: int) (y: int) (z: int) =
x + y + z
let tuple ( (x: (int * float)) ) =
x
let destructured_tuple ((a, b): int * int) =
a + b
let array (x: int array) = function
| [|x|] -> x
| [| x; y; z |] -> x + y + x
| _ -> 0
let nested_array (x: int array array) = function
| [| [| [| x |] |] |] -> x
| [| [| [| x; y; z |] |] |] -> x + y + z
| _ -> 0
let list (x: int list) = function
| [x] -> x
| [ x; y; z ] -> x + y + x
| _ -> 0
let nested_list (x: int list list) = function
| [ [ [ x ] ] ] -> x
| [ [ [ x; y; z ] ] ] -> x + y + x
| _ -> 0
let return_value =
(Some (Ok (Some (2))))
let type_argument (x: seq<'a>) =
x
let nested_type_argument (x: seq<seq<seq<int>>>) =
x
type Record =
{ a: int
b: string
}
type Union =
| Tuple of (int * float)
| NestedTuple of (int * (int * (int * int)))
| TypeArgs of Result<seq<int>, float>
type Wrapper = Wrapper of int * int
let unwrap (Wrapper (a, b)) =
a + b
let lambda =
(fun x -> (fun (a, b) -> x))
let match_test x =
match x with
| (Some (((((Some (a))))))) -> a
| _ -> 0
let unit_args () () () =
()
let computation_expressions asyncFn (x: int) =
async {
let t =
task {
let a = 2
let b = 3
return async {
let! res = asyncFn (x)
return res + a + b
}
}
return t
}
let if_tests (x: int) =
if x <> 0 then
()
elif x < 1 then
()
else
()
type Class(a: int) =
member _.A () =
(a)
member this.Member () =
()
static member StaticMember () =
()
let main _ =
unit_args () ((((((((((())))))))))) ();
one_arg ((((((((((((1)))))))))))) |> ignore;
two_args (1) (((((((((2))))))))) |> ignore;