package current

  1. Overview
  2. Docs

Source file output.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
type active = [`Ready | `Running | `Waiting_for_confirmation]
  [@@deriving eq]

type 'a t = ('a, [`Active of active | `Msg of string]) result
  [@@deriving eq]

let pp ok f = function
  | Ok x -> Fmt.pf f "Ok: %a" ok x
  | Error (`Active `Ready) -> Fmt.string f "Ready"
  | Error (`Active `Running) -> Fmt.string f "Running"
  | Error (`Active `Waiting_for_confirmation) -> Fmt.string f "Waiting for confirmation"
  | Error (`Msg e) -> Fmt.pf f "Error: %s" e

module Blockable = struct

  type 'a t = ('a, [`Active of active | `Msg of string | `Blocked]) result
  [@@deriving eq]

  let pp ok f = function
    | Ok x -> pp ok f (Ok x)
    | Error (`Active v) -> pp ok f (Error (`Active v))
    | Error (`Msg e) -> pp ok f (Error (`Msg e))
    | Error `Blocked -> Fmt.string f "Blocked"

end
OCaml

Innovation. Community. Security.