package bonsai

  1. Overview
  2. Docs
A library for building dynamic webapps, using Js_of_ocaml

Install

Dune Dependency

Authors

Maintainers

Sources

bonsai-v0.16.0.tar.gz
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303

doc/src/bonsai/var.ml.html

Source file var.ml

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

type 'a t = 'a Incr.Var.t

let create x = Incr.Var.create x

let set t v =
  if Incr.am_stabilizing ()
  then failwith "Bonsai.Var mutated during the computation of a Bonsai value";
  Incr.Var.set t v
;;

let update t ~f =
  let old = Incr.Var.value t in
  set t (f old)
;;

let get t = Incr.Var.value t
let value t = t |> Incr.Var.watch |> Value.of_incr
let incr_var = Fn.id
OCaml

Innovation. Community. Security.