package incremental

  1. Overview
  2. Docs
Library for incremental computations

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=bcd6da0c70d9f0b0d528b16d8faf800dd92cd45dca817f4b750628921671e8e0

doc/src/incremental/scope.ml.html

Source file scope.ml

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
open Core
open! Import
module Node = Types.Node
include Types.Scope

let top = Top

let is_top = function
  | Top -> true
  | Bind _ -> false
;;

let invariant = function
  | Top -> ()
  | Bind bind -> Bind.invariant ignore ignore bind
;;

(* Unlike for nodes, there is no invariant [is_necessary t <=> height > -1] (doesn't work
   because of [Top]).  This is fine since the height of a scope is only used to constrain
   other heights, not to schedule it. *)
let height = function
  | Top -> -1
  | Bind bind -> bind.lhs_change.height
;;

let is_valid = function
  | Top -> true
  | Bind bind -> Bind.is_valid bind
;;

let is_necessary = function
  | Top -> true
  | Bind bind -> Node.is_necessary bind.main
;;

let add_node t (node : _ Node.t) =
  assert (phys_equal node.created_in t);
  match t with
  | Top -> ()
  | Bind bind ->
    node.next_node_in_same_scope <- bind.all_nodes_created_on_rhs;
    bind.all_nodes_created_on_rhs <- Uopt.some (Types.Node.Packed.T node)
;;
OCaml

Innovation. Community. Security.