1Misc(3)                          OCaml library                         Misc(3)
2
3
4

NAME

6       Misc - no description
7

Module

9       Module   Misc
10

Documentation

12       Module Misc
13        : sig end
14
15
16
17
18
19
20
21
22       val fatal_error : string -> 'a
23
24
25
26
27       val  fatal_errorf : ('a, Format.formatter, unit, 'b) Pervasives.format4
28       -> 'a
29
30
31
32
33       exception Fatal_error
34
35
36
37
38
39       val try_finally : (unit -> 'a) -> (unit -> unit) -> 'a
40
41
42
43
44       val map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list
45
46
47
48
49       val map_left_right : ('a -> 'b) -> 'a list -> 'b list
50
51
52
53
54       val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
55
56
57
58
59       val replicate_list : 'a -> int -> 'a list
60
61
62
63
64       val list_remove : 'a -> 'a list -> 'a list
65
66
67
68
69       val split_last : 'a list -> 'a list * 'a
70
71
72
73
74       val may : ('a -> unit) -> 'a option -> unit
75
76
77
78
79       val may_map : ('a -> 'b) -> 'a option -> 'b option
80
81
82
83       type ref_and_value =
84        | R : 'a Pervasives.ref * 'a -> ref_and_value
85
86
87
88
89
90       val protect_refs : ref_and_value list -> (unit -> 'a) -> 'a
91
92
93       protect_refs l f temporarily sets r to v for each R (r, v) in  l  while
94       executing  f . The previous contents of the references is restored even
95       if f raises an exception.
96
97
98       module Stdlib : sig end
99
100
101
102
103
104       val find_in_path : string list -> string -> string
105
106
107
108
109       val find_in_path_rel : string list -> string -> string
110
111
112
113
114       val find_in_path_uncap : string list -> string -> string
115
116
117
118
119       val remove_file : string -> unit
120
121
122
123
124       val expand_directory : string -> string -> string
125
126
127
128
129       val create_hashtable : int -> ('a * 'b) list -> ('a, 'b) Hashtbl.t
130
131
132
133
134       val copy_file : Pervasives.in_channel -> Pervasives.out_channel -> unit
135
136
137
138
139       val copy_file_chunk : Pervasives.in_channel  ->  Pervasives.out_channel
140       -> int -> unit
141
142
143
144
145       val string_of_file : Pervasives.in_channel -> string
146
147
148
149
150       val  output_to_file_via_temporary  : ?mode:Pervasives.open_flag list ->
151       string -> (string -> Pervasives.out_channel -> 'a) -> 'a
152
153
154
155
156       val log2 : int -> int
157
158
159
160
161       val align : int -> int -> int
162
163
164
165
166       val no_overflow_add : int -> int -> bool
167
168
169
170
171       val no_overflow_sub : int -> int -> bool
172
173
174
175
176       val no_overflow_mul : int -> int -> bool
177
178
179
180
181       val no_overflow_lsl : int -> int -> bool
182
183
184
185       module Int_literal_converter : sig end
186
187
188
189
190
191       val chop_extensions : string -> string
192
193
194
195
196       val search_substring : string -> string -> int -> int
197
198
199
200
201       val replace_substring : before:string  ->  after:string  ->  string  ->
202       string
203
204
205
206
207       val rev_split_words : string -> string list
208
209
210
211
212       val get_ref : 'a list Pervasives.ref -> 'a list
213
214
215
216
217       val fst3 : 'a * 'b * 'c -> 'a
218
219
220
221
222       val snd3 : 'a * 'b * 'c -> 'b
223
224
225
226
227       val thd3 : 'a * 'b * 'c -> 'c
228
229
230
231
232       val fst4 : 'a * 'b * 'c * 'd -> 'a
233
234
235
236
237       val snd4 : 'a * 'b * 'c * 'd -> 'b
238
239
240
241
242       val thd4 : 'a * 'b * 'c * 'd -> 'c
243
244
245
246
247       val for4 : 'a * 'b * 'c * 'd -> 'd
248
249
250
251       module LongString : sig end
252
253
254
255
256
257       val edit_distance : string -> string -> int -> int option
258
259
260       edit_distance  a  b cutoff computes the edit distance between strings a
261       and b . To help efficiency, it uses a cutoff:  if  the  distance  d  is
262       smaller than cutoff , it returns Some d , else None .
263
264       The  distance  algorithm currently used is Damerau-Levenshtein: it com‐
265       putes the number of insertion, deletion, substitution  of  letters,  or
266       swapping of adjacent letters to go from one word to the other. The par‐
267       ticular algorithm may change in the future.
268
269
270
271       val spellcheck : string list -> string -> string list
272
273
274       spellcheck env name takes a list of names env that exist in the current
275       environment  and  an erroneous name , and returns a list of suggestions
276       taken from env , that are close enough to name that it may  be  a  typo
277       for one of them.
278
279
280
281       val did_you_mean : Format.formatter -> (unit -> string list) -> unit
282
283
284       did_you_mean  ppf get_choices hints that the user may have meant one of
285       the option returned by calling get_choices . It  does  nothing  if  the
286       returned list is empty.
287
288       The unit -> ...  thunking is meant to delay any potentially-slow compu‐
289       tation (typically computing edit-distance with  many  things  from  the
290       current  environment)  to  when  the hint message is to be printed. You
291       should  print  an   understandable   error   message   before   calling
292       did_you_mean  ,  so  that users get a clear notification of the failure
293       even if producing the hint is slow.
294
295
296
297       val cut_at : string -> char -> string * string
298
299
300       String.cut_at s c returns a pair containing the sub-string  before  the
301       first  occurrence of c in s , and the sub-string after the first occur‐
302       rence of c in s .  let (before, after) = String.cut_at s c in before  ^
303       String.make 1 c ^ after is the identity if s contains c .
304
305       Raise Not_found if the character does not appear in the string
306
307
308       Since 4.01
309
310
311       module StringSet : sig end
312
313
314
315
316       module StringMap : sig end
317
318
319
320
321       module Color : sig end
322
323
324
325
326
327       val normalise_eol : string -> string
328
329
330       normalise_eol  s  returns  a  fresh  copy of s with any '\r' characters
331       removed. Intended for pre-processing text which  will  subsequently  be
332       printed on a channel which performs EOL transformations (i.e. Windows)
333
334
335
336       val delete_eol_spaces : string -> string
337
338
339       delete_eol_spaces s returns a fresh copy of s with any end of line spa‐
340       ces removed. Intended to normalize  the  output  of  the  toplevel  for
341       tests.
342
343
344
345
346       ===  Hook  machinery  Hooks  machinery: add_hook name f will register a
347       function that will be called  on  the  argument  of  a  later  call  to
348       apply_hooks.  Hooks  are  applied in the lexicographical order of their
349       names. ===
350
351
352       type hook_info = {
353        sourcefile : string ;
354        }
355
356
357
358
359
360       exception HookExnWrapper of {
361        error : exn ;
362        hook_name : string ;
363        hook_info : hook_info ;
364        }
365
366
367       An exception raised by a hook will be  wrapped  into  a  HookExnWrapper
368       constructor by the hook machinery.
369
370
371
372       val raise_direct_hook_exn : exn -> 'a
373
374       A hook can use raise_unwrapped_hook_exn to raise an exception that will
375       not be wrapped into a Misc.HookExnWrapper .
376
377
378       module type HookSig = sig end
379
380
381
382
383       module MakeHooks : functor (M : sig end) -> sig end
384
385
386
387
388
389
390
391OCamldoc                          2018-07-14                           Misc(3)
Impressum