aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/UltiSnips/ocaml.snippets
blob: 1ebc3477f26d8982bcaf187a7b9e93f05cbbf33c (plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
priority -50

snippet rs "raise" b
raise (${1:Not_found})
endsnippet

snippet open "open"
let open ${1:module} in
${2:e}
endsnippet

snippet try "try"
try ${1:e}
with ${2:Not_found} -> ${3:()}
endsnippet

snippet ref "ref"
let ${1:name} = ref ${2:val} in
${3:e}
endsnippet

snippet matchl "pattern match on a list"
match ${1:list} with
| [] -> ${2:()}
| x::xs -> ${3:()}
endsnippet

snippet matcho "pattern match on an option type"
match ${1:x} with
| Some(${2:y}) -> ${3:()}
| None -> ${4:()}
endsnippet

snippet fun "anonymous function"
(fun ${1:x} -> ${2:x})
endsnippet

snippet cc "commment"
(* ${1:comment} *)
endsnippet

snippet let "let .. in binding"
let ${1:x} = ${2:v} in
${3:e}
endsnippet

snippet lr "let rec"
let rec ${1:f} =
	${2:expr}
endsnippet

snippet if "if"
if ${1:(* condition *)} then
	${2:(* A *)}
else
	${3:(* B *)}
endsnippet

snippet If "If"
if ${1:(* condition *)} then
	${2:(* A *)}
endsnippet

snippet while "while"
while ${1:(* condition *)} do
	${2:(* A *)}
done
endsnippet

snippet for "for"
for ${1:i} = ${2:1} to ${3:10} do
	${4:(* BODY *)}
done
endsnippet

snippet match "match"
match ${1:(* e1 *)} with
| ${2:p} -> ${3:e2}
endsnippet

snippet Match "match"
match ${1:(* e1 *)} with
| ${2:p} -> ${3:e2}
endsnippet

snippet class "class"
class ${1:name} = object
	${2:methods}
end
endsnippet

snippet obj "obj"
object
	${2:methods}
end
endsnippet

snippet Obj "object"
object (self)
	${2:methods}
end
endsnippet

snippet {{ "object functional update"
{< ${1:x} = ${2:y} >}
endsnippet

snippet beg "beg"
begin
	${1:block}
end
endsnippet

snippet ml "module instantiantion with functor"
module ${1:Mod} = ${2:Functor}(${3:Arg})
endsnippet

snippet mod "module - no signature"
module ${1:(* Name *)} = struct
	${2:(* BODY *)}
end
endsnippet

snippet Mod "module with signature"
module ${1:(* Name *)} : ${2:(* SIG *)} = struct
	${3:(* BODY *)}
end
endsnippet

snippet sig "anonymous signature"
sig
	${2:(* BODY *)}
end
endsnippet

snippet sigf "functor signature or anonymous functor"
functor (${1:Arg} : ${2:ARG}) -> ${3:(* BODY *)}
endsnippet

snippet func "define functor - no signature"
module ${1:M} (${2:Arg} : ${3:ARG}) = struct
	${4:(* BODY *)}
end
endsnippet

snippet Func "define functor - with signature"
module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct
	${5:(* BODY *)}
end
endsnippet

snippet mot "Declare module signature"
module type ${1:(* Name *)} = sig
	${2:(* BODY *)}
end
endsnippet

snippet module "Module with anonymous signature"
module ${1:(* Name *)} : sig
	${2:(* SIGNATURE *)}
end = struct
	${3:(* BODY *)}
end
endsnippet

snippet oo "odoc"
(** ${1:odoc} *)
endsnippet

snippet qt "inline qtest"
(*$T ${1:name}
	${2:test}
*)
endsnippet