package base

  1. Overview
  2. Docs
Full standard library replacement for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.3.tar.gz
md5=2100b0ed13fecf43be86ed45c5b2cc4d
sha512=628610caff7e124631870fa1e29661caac28bdfdb18750ee43b868037da3d65d6dd9023b4be7c4c52405679efb5e865a6632d95606a22b28a36636a6bf706ef3

doc/src/base/invariant.ml.html

Source file invariant.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
open! Import
include Invariant_intf

let raise_s = Error.raise_s

let invariant here t sexp_of_t f : unit =
  try f () with
  | exn ->
    raise_s
      (Sexp.message
         "invariant failed"
         [ "", Source_code_position0.sexp_of_t here
         ; "exn", sexp_of_exn exn
         ; "", sexp_of_t t
         ])
;;

let check_field t f field =
  try f (Field.get field t) with
  | exn ->
    raise_s
      (Sexp.message
         "problem with field"
         [ "field", sexp_of_string (Field.name field); "exn", sexp_of_exn exn ])
;;
OCaml

Innovation. Community. Security.