package base

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file nothing.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
open! Import

module T = struct
  type t = |

  let unreachable_code_local = function
    | (_ : t) -> .
  ;;

  let unreachable_code x = unreachable_code_local x
  let all = []
  let hash_fold_t _ t = unreachable_code t
  let hash = unreachable_code
  let compare a _ = unreachable_code a
  let compare__local a _ = unreachable_code a
  let equal__local a _ = unreachable_code a
  let sexp_of_t = unreachable_code
  let t_of_sexp sexp = Sexplib0.Sexp_conv_error.empty_type "Base.Nothing.t" sexp
  let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = { untyped = Union [] }
  let to_string = unreachable_code
  let of_string (_ : string) = failwith "Base.Nothing.of_string: not supported"
  let globalize = unreachable_code
end

include T

include Identifiable.Make (struct
  include T

  let module_name = "Base.Nothing"
end)

let must_be_none : t option -> unit = function
  | None -> ()
  | Some _ -> .
;;

let must_be_empty : t list -> unit = function
  | [] -> ()
  | _ :: _ -> .
;;

let must_be_ok : ('ok, t) Result.t -> 'ok = function
  | Ok ok -> ok
  | Error _ -> .
;;

let must_be_error : (t, 'err) Result.t -> 'err = function
  | Ok _ -> .
  | Error error -> error
;;

let must_be_first : ('first, t) Either.t -> 'first = function
  | First first -> first
  | Second _ -> .
;;

let must_be_second : (t, 'second) Either.t -> 'second = function
  | First _ -> .
  | Second second -> second
;;
OCaml

Innovation. Community. Security.