forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
projection.mli
80 lines (68 loc) · 3.15 KB
/
projection.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
77
78
79
80
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Pierre Chambart, OCamlPro *)
(* Mark Shinwell and Leo White, Jane Street Europe *)
(* *)
(* Copyright 2013--2016 OCamlPro SAS *)
(* Copyright 2014--2016 Jane Street Group LLC *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
(** Representation of projections from closures and blocks. *)
(** The selection of one closure given a set of closures, required before
a function defined by said set of closures can be applied. See more
detailed documentation below on [set_of_closures]. *)
type project_closure = {
set_of_closures : Variable.t; (** must yield a set of closures *)
closure_id : Closure_id.t;
}
(** The selection of one closure given another closure in the same set of
closures. See more detailed documentation below on [set_of_closures].
The [move_to] closure must be part of the free variables of
[start_from]. *)
type move_within_set_of_closures = {
closure : Variable.t; (** must yield a closure *)
start_from : Closure_id.t;
move_to : Closure_id.t;
}
(** The selection from a closure of a variable bound by said closure.
In other words, access to a function's environment. Also see more
detailed documentation below on [set_of_closures]. *)
type project_var = {
closure : Variable.t; (** must yield a closure *)
closure_id : Closure_id.t;
var : Var_within_closure.t;
}
val print_project_closure
: Format.formatter
-> project_closure
-> unit
val print_move_within_set_of_closures
: Format.formatter
-> move_within_set_of_closures
-> unit
val print_project_var
: Format.formatter
-> project_var
-> unit
val compare_project_var : project_var -> project_var -> int
val compare_project_closure : project_closure -> project_closure -> int
val compare_move_within_set_of_closures
: move_within_set_of_closures
-> move_within_set_of_closures
-> int
type t =
| Project_var of project_var
| Project_closure of project_closure
| Move_within_set_of_closures of move_within_set_of_closures
| Field of int * Variable.t
include Identifiable.S with type t := t
(** Return which variable the given projection projects from. *)
val projecting_from : t -> Variable.t
(** Change the variable that the given projection projects from. *)
val map_projecting_from : t -> f:(Variable.t -> Variable.t) -> t