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

type 'a t = 'a Result.t

let return x = Ok x [@@inline]

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

let ( let* ) x f = bind x f [@@inline]

let map v f = Result.map f v [@@inline]

let ( let+ ) v f = map v f [@@inline]

let select b ~prio_true:_ ~prio_false:_ = Ok b [@@inline]

let select_i32 i = Ok i [@@inline]

let trap t = Error t

let run m = m

let get_pc () = return Smtml.Expr.Set.empty

let assume v =
  if v then Ok ()
  else
    (* TODO: there could be a dedicated error here? *)
    assert false

let ite cond ~if_true ~if_false =
  if cond then return if_true else return if_false
[@@inline]