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
(* SPDX-License-Identifier: AGPL-3.0-or-later *)
(* Copyright © 2021-2024 OCamlPro *)
(* Written by the Owi programmers *)

type 'a t = 'a

let return x = x [@@inline]

let bind x f = f x [@@inline]

let ( let* ) = bind

let map v f =
  let* v in
  return (f v)
[@@inline]

let ( let+ ) = map

let select b = b [@@inline]

let select_i32 i = i [@@inline]

let trap msg = raise (Types.Trap msg)

let trap : Trap.t -> 'a t = fun tr -> trap (Trap.to_string tr)

let run = Fun.id