package catt

  1. Overview
  2. Docs

Source file suspension.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
open Kernel

let rec iter_n_times n f base =
  if n <= 0 then base else f (iter_n_times (n - 1) f base)

let iter_option f n base =
  match n with None -> base | Some n -> iter_n_times n f base

let ps = iter_option Unchecked.suspend_ps
let ty = iter_option Unchecked.suspend_ty
let tm = iter_option Unchecked.suspend_tm
let sub_ps = iter_option Unchecked.suspend_sub_ps
let ctx = iter_option Unchecked.suspend_ctx

let coh i coh =
  match i with
  | None | Some 0 -> coh
  | Some n ->
      let p, t, (name, susp, f) = Coh.forget coh in
      check_coh (ps i p) (ty i t) (name, susp + n, f)