ligo/vendors/ligo-utils/simple-utils/x_string.ml

18 lines
440 B
OCaml
Raw Normal View History

2020-04-27 13:30:59 +04:00
type t =
Standard of string
| Verbatim of string
let pp ppf = function
Standard s -> Format.fprintf ppf "%S" s
| Verbatim v -> Format.fprintf ppf "{|%s|}" v
let compare ?(compare=compare) a b = match a,b with
(Standard a, Standard b) -> compare a b
| (Standard _, Verbatim _) -> -1
| (Verbatim _, Standard _) -> 1
| (Verbatim a, Verbatim b) -> compare a b
2020-04-27 13:30:59 +04:00
let extract = function
Standard s -> s
| Verbatim v -> v