forked from savonet/liquidsoap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlang_types.mli
76 lines (60 loc) · 2.83 KB
/
lang_types.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
72
73
74
75
76
(*****************************************************************************
Liquidsoap, a programmable audio stream generator.
Copyright 2003-2018 Savonet team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details, fully stated in the COPYING
file at the root of the liquidsoap distribution.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************)
type pos = (Lexing.position * Lexing.position)
val print_single_pos : Lexing.position -> string
val print_pos : ?prefix:string -> pos -> string
type variance = Covariant | Contravariant | Invariant
type ground = Unit | Bool | Int | String | Float
val print_ground : ground -> string
type constr = Num | Ord | Getter of ground | Dtools | Arity_fixed | Arity_any
type constraints = constr list
val print_constr : constr -> string
type t = { pos : pos option; mutable level : int; mutable descr : descr; }
and constructed = { name : string ; params : (variance*t) list }
and descr =
| Constr of constructed
| Ground of ground
| List of t
| Product of t * t
| Zero | Succ of t | Variable
| Arrow of (bool * string * t) list * t
| EVar of int * constraints
| Link of t
val make : ?pos:pos option -> ?level:int -> descr -> t
val dummy : t
val pp_type : Format.formatter -> t -> unit
val pp_type_generalized :
((int*constraints) list) -> Format.formatter -> t -> unit
val print : ?generalized:((int*constraints) list) -> t -> string
val doc_of_type : generalized:((int*constraints) list) -> t -> Doc.item
exception Occur_check of t*t
val occur_check : t -> t -> unit
exception Unsatisfied_constraint of constr*t
val bind : t -> t -> unit
val deref : t -> t
val filter_vars : (t -> bool) -> t -> (int*constraints) list
val copy_with : ((int*constraints)*t) list -> t -> t
val instantiate : level:int -> generalized:((int*constraints) list) -> t -> t
val generalizable : level:int -> t -> (int*constraints) list
type explanation
exception Type_Error of explanation
val print_type_error : explanation -> unit
val ( <: ) : t -> t -> unit
val ( >: ) : t -> t -> unit
val fresh : constraints:constraints -> level:int -> pos:pos option -> t
val fresh_evar : level:int -> pos:pos option -> t
val iter_constr : (bool -> constructed -> unit) -> t -> bool*bool