aboutsummaryrefslogtreecommitdiff
path: root/lib/expression/compose.mli
blob: 4cced8cbb86fcaf27f4a24cb81bf6c00aa140d10 (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
(** Build an expression module with the result from another expression. The
    signature of the fuctions is a bit different, as they all receive the
    result from the previous evaluated element in argument. *)
module Expression
    (E : Sym.SYM_EXPR)
    (_ : sig
      val v : 'a E.path_repr
    end) : sig
  (** The signature for the module the adapt is a bit different for the
      SYM_EXPR: every function takes an extra argument which is the Expression
      we are wrapping, and every expression becomes a tuple with the same
      expression represented in the composed type. *)
  module type SIG = sig
    type 'a repr
    type 'a obs
    type 'a path_repr

    val empty : 'a E.obs -> 'a repr
    val expr : 'a E.obs * 'a repr -> 'a E.obs -> 'a repr
    val literal : string -> 'a E.obs -> 'a repr
    val integer : string -> 'a E.obs -> 'a repr
    val path : 'a path_repr -> 'a -> 'a E.obs -> 'a repr
    val concat : ('a E.obs * 'a repr) list -> 'a E.obs -> 'a repr

    val window :
      ('a E.obs * 'a repr) T.window ->
      ('a E.obs * 'a repr) list ->
      ('a E.obs * 'a repr) list ->
      'a E.obs ->
      'a repr

    val nvl : ('a E.obs * 'a repr) list -> 'a E.obs -> 'a repr
    val join : string -> ('a E.obs * 'a repr) list -> 'a E.obs -> 'a repr

    val boperator :
      T.binary_operator ->
      'a E.obs * 'a repr ->
      'a E.obs * 'a repr ->
      'a E.obs ->
      'a repr

    val gequality :
      T.binary_operator ->
      'a E.obs * 'a repr ->
      ('a E.obs * 'a repr) list ->
      'a E.obs ->
      'a repr

    val funct : string -> ('a E.obs * 'a repr) list -> 'a E.obs -> 'a repr
    val function' : T.funct -> ('a E.obs * 'a repr) list -> 'a E.obs -> 'a repr
    val observe : 'a E.obs * 'a repr -> 'a obs
  end

  module Make (M : SIG) :
    Sym.SYM_EXPR
      with type 'a obs = 'a M.obs
       and type 'a repr = 'a E.repr * 'a M.repr
       and type 'a path_repr = 'a M.path_repr
end