forked from ahrefs/devkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prelude.mli
71 lines (51 loc) · 1.87 KB
/
prelude.mli
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
(** Useful shortcuts *)
module U = ExtUnix.Specific
module Enum = ExtEnum
(** function composition : [f $ g] is equivalent to [(fun x -> f (g x))] *)
val ( $ ) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
(** 2-function composition : [f $$ g] is equivalent to [(fun x y -> f (g x) (g y))] *)
val ( $$ ) : ('a -> 'a -> 'b) -> ('c -> 'a) -> 'c -> 'c -> 'b
(** identity *)
val id : 'a -> 'a
(** idem *)
val identity : 'a -> 'a
(** reverse arguments, [flip f x y] is equivalent to [f y x] *)
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
(** map over 2-tuple *)
val apply2 : ('a -> 'b) -> 'a * 'a -> 'b * 'b
(** [some x] is equivalent to [Some x] *)
val some : 'a -> 'a option
(** @return function returning given value *)
val const : 'a -> (unit -> 'a)
(** @return curried version from function of tuple *)
val curry : ('a * 'b -> 'c) -> ('a -> 'b -> 'c)
(** @return function of tuple from curried function *)
val uncurry : ('a -> 'b -> 'c) -> ('a * 'b -> 'c)
(** [Lazy.force] *)
val ( !! ) : 'a Lazy.t -> 'a
(** printf to stdout with newline *)
val printfn : ('a, unit, string, unit) format4 -> 'a
(** printf to stderr with newline *)
val eprintfn : ('a, unit, string, unit) format4 -> 'a
(** abstract type generator *)
module Fresh(T : sig type t val compare : t -> t -> int end)() :
sig
type t
val inject : T.t -> t
val project : t -> T.t
val inject_list : T.t list -> t list
val project_list : t list -> T.t list
val compare : t -> t -> int
val equal : t -> t -> bool
end
val tuck : 'a list ref -> 'a -> unit
val cons : 'a list -> 'a -> 'a list
val ( += ) : int ref -> int -> unit
val ( -= ) : int ref -> int -> unit
val round : float -> float
(** [atoi name value]
@return integer of string [value]
@raise Failure if [value] is not an integer (with [name] and [value] in exception message)
*)
val atoi : string -> string -> int
val call_me_maybe : ('a -> unit) option -> 'a -> unit