ligo/vendors/ligo-utils/simple-utils/display.mli
Lesenechal Remi c6b95bf07a result monad refactoring:
- do not use plain JSON rep for errors and use polymorphic variants instead
- split formatting for human readable and JSON output
- no more simple_errors simple_fails
- much less result bindings used in stages
2020-06-15 14:45:28 +02:00

31 lines
822 B
OCaml

type json = Yojson.Basic.t
type 'a display_format =
| Human_readable : string display_format
| Dev : string display_format
| Json : json display_format
type ex_display_format = Ex_display_format : 'a display_format -> ex_display_format
val human_readable : ex_display_format
val dev : ex_display_format
val json : ex_display_format
type 'a pp = display_format:(string display_format) -> Format.formatter -> 'a -> unit
type 'a format = {
pp : 'a pp ;
to_json : 'a -> json ;
}
type 'a with_format = {
value : 'a ;
format : 'a format ;
}
type displayable = Displayable : 'a with_format -> displayable
val convert : display_format:'output display_format -> displayable -> 'output
val to_json : displayable -> json
val bind_format : 'value format -> 'error format -> ('value,'error) result format