package octez-protocol-alpha-libs

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

Source file scenario_constants.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
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2024 Nomadic Labs, <contact@nomadic-labs.com>               *)
(*                                                                           *)
(*****************************************************************************)

open Scenario_dsl

type constants = Constants_helpers.t

(* Not a Set *)
module S = Constants_helpers.Set

let set :
    ('a -> constants -> constants) -> 'a -> (constants, constants) scenarios =
 fun f x -> Action (fun csts -> Lwt_result_syntax.return @@ f x csts)

let set_opt :
    ('a -> constants -> constants) ->
    'a option ->
    (constants, constants) scenarios =
 fun f -> function None -> Empty | Some x -> set f x

let sets :
    ('a -> constants -> constants) ->
    (string * 'a) list ->
    (constants, constants) scenarios =
 fun f -> fold_tag (set f)

let sets_f :
    ('a -> constants -> constants) ->
    ('a -> string) ->
    'a list ->
    (constants, constants) scenarios =
 fun f f_tag -> fold_tag_f (set f) f_tag

let branch_flag :
    (bool -> constants -> constants) -> (constants, constants) scenarios =
 fun f -> sets f [("true", true); ("false", false)]

let branch_flags :
    (bool -> constants -> constants) list -> (constants, constants) scenarios =
  unfold branch_flag

let sets_int :
    (int -> constants -> constants) ->
    int list ->
    (constants, constants) scenarios =
 fun f -> sets_f f string_of_int
OCaml

Innovation. Community. Security.