Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
open Alpha_context
open Script_typed_ir
let rec serialize_stack_prefix_preservation_witness :
type b a b_s b_a.
(b, a, b_s, b_a) stack_prefix_preservation_witness -> string = function
| Prefix next ->
Format.sprintf
"(Prefix (%s))"
(serialize_stack_prefix_preservation_witness next)
| Rest ->
"(Rest)"
let rec serialize_dup_n_gadt_witness :
type b a. (b, a) dup_n_gadt_witness -> string = function
| Dup_n_zero ->
"(Dup_n_zero)"
| Dup_n_succ next ->
Format.sprintf "(Dup_n_succ (%s))" (serialize_dup_n_gadt_witness next)
let rec serialize_comb_gadt_witness :
type b a. (b, a) comb_gadt_witness -> string = function
| Comb_one ->
"(Comb_one)"
| Comb_succ next ->
Format.sprintf "(Comb_succ (%s))" (serialize_comb_gadt_witness next)
let rec serialize_comb_get_gadt_witness :
type b a. (b, a) comb_get_gadt_witness -> string = function
| Comb_get_zero ->
"(Comb_get_zero)"
| Comb_get_one ->
"(Comb_get_one)"
| Comb_get_plus_two next ->
Format.sprintf
"(Comb_get_plus_two (%s))"
(serialize_comb_get_gadt_witness next)
let rec serialize_comb_set_gadt_witness :
type v b a. (v, b, a) comb_set_gadt_witness -> string = function
| Comb_set_zero ->
"(Comb_set_zero)"
| Comb_set_one ->
"(Comb_set_one)"
| Comb_set_plus_two next ->
Format.sprintf
"(Comb_set_plus_two (%s))"
(serialize_comb_set_gadt_witness next)
let rec serialize_uncomb_gadt_witness :
type b a. (b, a) uncomb_gadt_witness -> string = function
| Uncomb_one ->
"(Uncomb_one)"
| Uncomb_succ next ->
Format.sprintf "(Uncomb_succ (%s))" (serialize_uncomb_gadt_witness next)
let serialize_address (contract, string) =
Format.sprintf "((%s) (%s))" (Contract.to_b58check contract) string
let rec serialize_value : type v. v ty -> v -> string =
fun ty v ->
match ty with
| Unit_t _ ->
"(Unit_t)"
| Int_t _ ->
Format.sprintf "(Int_t (%s))" (Script_int.to_string v)
| Nat_t _ ->
Format.sprintf "(Nat_t (%s))" (Script_int.to_string v)
| Signature_t _ ->
Format.sprintf "(Signature_t (%s))" (Signature.to_b58check v)
| String_t _ ->
(* TODO: this needs escaping, definitely *)
Format.sprintf "(String_t (%s))" v
| Bytes_t _ ->
(* TODO: this needs escaping, definitely *)
Format.sprintf "(Bytes_t (%s))" (Bytes.to_string v)
| Mutez_t _ ->
Format.sprintf "(Mutez_t (%s))" (Tez.to_string v)
| Key_hash_t _ ->
Format.sprintf
"(Key_hash_t (%s))"
(Signature.Public_key_hash.to_b58check v)
| Key_t _ ->
Format.sprintf "(Key_t (%s))" (Signature.Public_key.to_b58check v)
| Timestamp_t _ ->
Format.sprintf "(Timestamp_t (%s))" (Script_timestamp.to_string v)
| Address_t _ ->
Format.sprintf "(Address_t (%s))" (serialize_address v)
| Bool_t _ ->
Format.sprintf "(Bool_t (%b))" v
| Pair_t ((ty1, _, _), (ty2, _, _), _) ->
let (v1, v2) = v in
Format.sprintf
"(Pair_t (%s) (%s))"
(serialize_value ty1 v1)
(serialize_value ty2 v2)
| Union_t ((ty1, _), (ty2, _), _) ->
let union =
match v with
| L l ->
serialize_value ty1 l
| R r ->
serialize_value ty2 r
in
Format.sprintf "(Union_t (%s))" union
| Lambda_t _ ->
Format.sprintf "(Lambda_t (%s))" (serialize_lambda v)
| Option_t (ty, _) ->
let v =
match v with
| Some v ->
Format.sprintf "(Some (%s))" (serialize_value ty v)
| None ->
"(None)"
in
Format.sprintf "(Option_t (%s))" v
| List_t (ty, _) ->
let v = List.map (serialize_value ty) v.elements in
Format.sprintf "(List_t (%s))" (String.concat " " v)
| Set_t (cty, _) ->
assert false
| Map_t (cty, ty, _) ->
assert false
| Big_map_t (cty, ty, _) ->
assert false
| Contract_t _ ->
let (ty, address) = v in
Format.sprintf
"(Contract_t (%s) (%s))"
(serialize_ty ty)
(serialize_address address)
| Sapling_transaction_t _ ->
let v =
v
|> Data_encoding.Binary.to_bytes_exn Sapling.transaction_encoding
|> Bytes.to_string
in
Format.sprintf "(Sapling_transaction_t (%s))" v
| Sapling_state_t (memo_size, _) ->
assert false
| Operation_t _ ->
assert false
| Chain_id_t _ ->
Format.sprintf "(Chain_id_t (%s))" (Chain_id.to_b58check v)
| Never_t _ ->
(* never is always | like unit is always ()*)
"(Never_t)"
| Bls12_381_g1_t _ ->
(* TODO: clearly needs escaping *)
Format.sprintf
"(Bls12_381_g1_t (%s))"
(Bytes.to_string (Bls12_381.G1.to_bytes v))
| Bls12_381_g2_t _ ->
Format.sprintf
"(Bls12_381_g2_t (%s))"
(Bytes.to_string (Bls12_381.G2.to_bytes v))
| Bls12_381_fr_t _ ->
Format.sprintf
"(Bls12_381_fr_t (%s))"
(Bytes.to_string (Bls12_381.Fr.to_bytes v))
| Ticket_t (cty, _) ->
Format.sprintf
"(Ticket_t (%s) (%s) (%s))"
(serialize_address v.ticketer)
(serialize_value_cty cty v.contents)
(Script_int.to_string v.amount)
and serialize_value_cty : type v. v comparable_ty -> v -> string =
fun cty v ->
match cty with
| Unit_key _ ->
"(Unit_key)"
| Never_key _ ->
"(Never_key)"
| Int_key _ ->
Format.sprintf "(Int_key (%s))" (Script_int.to_string v)
| Nat_key _ ->
Format.sprintf "(Nat_key (%s))" (Script_int.to_string v)
| Signature_key _ ->
Format.sprintf "(Signature_key (%s))" (Signature.to_b58check v)
| String_key _ ->
Format.sprintf "(String_key (%s))" v
| Bytes_key _ ->
Format.sprintf "(Bytes_key (%s))" (Bytes.to_string v)
| Mutez_key _ ->
Format.sprintf "(Mutez_key (%s))" (Tez.to_string v)
| Bool_key _ ->
Format.sprintf "(Bool_key (%b))" v
| Key_hash_key _ ->
Format.sprintf
"(Key_hash_key (%s))"
(Signature.Public_key_hash.to_b58check v)
| Key_key _ ->
Format.sprintf "(Key_key (%s))" (Signature.Public_key.to_b58check v)
| Timestamp_key _ ->
Format.sprintf "(Timestamp_key (%s))" (Script_timestamp.to_string v)
| Chain_id_key _ ->
Format.sprintf "(Chain_id_key (%s))" (Chain_id.to_b58check v)
| Address_key _ ->
Format.sprintf "(Address_key (%s))" (serialize_address v)
| Pair_key ((cty1, _), (cty2, _), _) ->
let (v1, v2) = v in
Format.sprintf
"(Pair_key (%s) (%s))"
(serialize_value_cty cty1 v1)
(serialize_value_cty cty2 v2)
| Union_key ((cty1, _), (cty2, _), _) ->
let union =
match v with
| L l ->
serialize_value_cty cty1 l
| R r ->
serialize_value_cty cty2 r
in
Format.sprintf "(Union_key (%s))" union
| Option_key (cty, _) ->
let v =
match v with
| Some v ->
Format.sprintf "(Some (%s))" (serialize_value_cty cty v)
| None ->
"(None)"
in
Format.sprintf "(Option_key (%s))" v
and serialize_ty : type v. v ty -> string =
fun ty ->
match ty with
| Unit_t _ ->
"(Unit_t)"
| Int_t _ ->
"(Int_t)"
| Nat_t _ ->
"(Nat_t)"
| Signature_t _ ->
"(Signature_t)"
| String_t _ ->
"(String_t)"
| Bytes_t _ ->
"(Bytes_t)"
| Mutez_t _ ->
"(Mutez_t)"
| Key_hash_t _ ->
"(Key_hash_t)"
| Key_t _ ->
"(Key_t)"
| Timestamp_t _ ->
"(Timestamp_t)"
| Address_t _ ->
"(Address_t)"
| Bool_t _ ->
"(Bool_t)"
| Pair_t ((ty1, _, _), (ty2, _, _), _) ->
Format.sprintf "(Pair_t (%s) (%s))" (serialize_ty ty1) (serialize_ty ty2)
| Union_t ((ty1, _), (ty2, _), _) ->
Format.sprintf
"(Union_t (%s) (%s))"
(serialize_ty ty1)
(serialize_ty ty2)
| Lambda_t (ty1, ty2, _) ->
Format.sprintf
"(Lambda_t (%s) (%s))"
(serialize_ty ty1)
(serialize_ty ty2)
| Option_t (ty, _) ->
Format.sprintf "(Option_t (%s))" (serialize_ty ty)
| List_t (ty, _) ->
Format.sprintf "(List_t (%s))" (serialize_ty ty)
| Set_t (cty, _) ->
Format.sprintf "(Set_t (%s))" (serialize_comparable_ty cty)
| Map_t (cty, ty, _) ->
Format.sprintf
"(Map_t (%s) (%s))"
(serialize_comparable_ty cty)
(serialize_ty ty)
| Big_map_t (cty, ty, _) ->
Format.sprintf
"(Big_map_t (%s) (%s))"
(serialize_comparable_ty cty)
(serialize_ty ty)
| Contract_t (ty, _) ->
Format.sprintf "(Contract_t (%s))" (serialize_ty ty)
| Sapling_transaction_t (memo_size, _) ->
Format.sprintf
"(Sapling_transaction_t (%s))"
(Z.to_string (Sapling.Memo_size.unparse_to_z memo_size))
| Sapling_state_t (memo_size, _) ->
Format.sprintf
"(Sapling_state_t (%s))"
(Z.to_string (Sapling.Memo_size.unparse_to_z memo_size))
| Operation_t _ ->
"(Operation_t)"
| Chain_id_t _ ->
"(Chain_id_t)"
| Never_t _ ->
"(Never_t)"
| Bls12_381_g1_t _ ->
"(Bls12_381_g1_t)"
| Bls12_381_g2_t _ ->
"(Bls12_381_g2_t)"
| Bls12_381_fr_t _ ->
"(Bls12_381_fr_t)"
| Ticket_t (cty, _) ->
Format.sprintf "(Ticket_t (%s))" (serialize_comparable_ty cty)
and serialize_comparable_ty : type v. v comparable_ty -> string = function
| Unit_key _ ->
"(Unit_key)"
| Never_key _ ->
"(Never_key)"
| Int_key _ ->
"(Int_key)"
| Nat_key _ ->
"(Nat_key)"
| Signature_key _ ->
"(Signature_key)"
| String_key _ ->
"(String_key)"
| Bytes_key _ ->
"(Bytes_key)"
| Mutez_key _ ->
"(Mutez_key)"
| Bool_key _ ->
"(Bool_key)"
| Key_hash_key _ ->
"(Key_hash_key)"
| Key_key _ ->
"(Key_key)"
| Timestamp_key _ ->
"(Timestamp_key)"
| Chain_id_key _ ->
"(Chain_id_key)"
| Address_key _ ->
"(Address_key)"
| Pair_key ((cty1, _), (cty2, _), _) ->
Format.sprintf
"(Pair_key (%s) (%s))"
(serialize_comparable_ty cty1)
(serialize_comparable_ty cty2)
| Union_key ((cty1, _), (cty2, _), _) ->
Format.sprintf
"(Union_key (%s) (%s))"
(serialize_comparable_ty cty1)
(serialize_comparable_ty cty2)
| Option_key (cty, _) ->
Format.sprintf "(Option_key (%s))" (serialize_comparable_ty cty)
and serialize_lambda : type b a. (b, a) lambda -> string = function
| Lam (descr, node) ->
let node = Micheline.strip_locations node in
let node =
Data_encoding.Binary.to_bytes_exn Script.expr_encoding node
|> Bytes.to_string
in
Format.sprintf "(Lam (%s) (%s))" (serialize_descr descr) node
and serialize_descr : type b a. (b, a) descr -> string =
fun descr ->
match (descr.instr, descr.aft) with
| (Drop, _) ->
"(Drop)"
| (Dup, _) ->
"(Dup)"
| (Swap, _) ->
"(Swap)"
| (Const v, Item_t (ty, _, _)) ->
Format.sprintf "(Const (%s))" (serialize_value ty v)
(* pairs *)
| (Cons_pair, _) ->
"(Cons_pair)"
| (Car, _) ->
"(Car)"
| (Cdr, _) ->
"(Cdr)"
| (Unpair, _) ->
"(Unpair)"
(* options *)
| (Cons_some, _) ->
"(Cons_some)"
| (Cons_none ty, _) ->
Format.sprintf "(Cons_none (%s))" (serialize_ty ty)
| (If_none (bl, br), _) ->
Format.sprintf
"(If_none (%s) (%s))"
(serialize_descr bl)
(serialize_descr br)
(* unions *)
| (Cons_left, _) ->
"(Cons_left)"
| (Cons_right, _) ->
"(Cons_right)"
| (If_left (bl, br), _) ->
Format.sprintf
"(If_left (%s) (%s))"
(serialize_descr bl)
(serialize_descr br)
(* lists *)
| (Cons_list, _) ->
"(Cons_list)"
| (Nil, _) ->
"(Nil)"
| (If_cons (bl, br), _) ->
Format.sprintf
"(If_cons (%s) (%s))"
(serialize_descr bl)
(serialize_descr br)
| (List_map body, _) ->
Format.sprintf "(List_map (%s))" (serialize_descr body)
| (List_iter body, _) ->
Format.sprintf "(List_iter (%s))" (serialize_descr body)
| (List_size, _) ->
"(List_size)"
(* sets *)
| (Empty_set cty, _) ->
Format.sprintf "(Empty_set (%s))" (serialize_comparable_ty cty)
| (Set_iter body, _) ->
Format.sprintf "(Set_iter (%s))" (serialize_descr body)
| (Set_mem, _) ->
"(Set_mem)"
| (Set_update, _) ->
"(Set_update)"
| (Set_size, _) ->
"(Set_size)"
(* maps *)
| (Empty_map (cty, ty), _) ->
Format.sprintf
"(Empty_map (%s) (%s))"
(serialize_comparable_ty cty)
(serialize_ty ty)
| (Map_map body, _) ->
Format.sprintf "(Map_map (%s))" (serialize_descr body)
| (Map_iter body, _) ->
Format.sprintf "(Map_iter (%s))" (serialize_descr body)
| (Map_mem, _) ->
"(Map_mem)"
| (Map_get, _) ->
"(Map_get)"
| (Map_update, _) ->
"(Map_update)"
| (Map_get_and_update, _) ->
"(Map_get_and_update)"
| (Map_size, _) ->
"(Map_size)"
(* big maps *)
| (Empty_big_map (cty, ty), _) ->
Format.sprintf
"(Empty_big_map (%s) (%s))"
(serialize_comparable_ty cty)
(serialize_ty ty)
| (Big_map_mem, _) ->
"(Big_map_mem)"
| (Big_map_get, _) ->
"(Big_map_get)"
| (Big_map_update, _) ->
"(Big_map_update)"
| (Big_map_get_and_update, _) ->
"(Big_map_get_and_update)"
(* string operations *)
| (Concat_string, _) ->
"(Concat_string)"
| (Concat_string_pair, _) ->
"(Concat_string_pair)"
| (Slice_string, _) ->
"(Slice_string)"
| (String_size, _) ->
"(String_size)"
(* bytes operations *)
| (Concat_bytes, _) ->
"(Concat_bytes)"
| (Concat_bytes_pair, _) ->
"(Concat_bytes_pair)"
| (Slice_bytes, _) ->
"(Slice_bytes)"
| (Bytes_size, _) ->
"(Bytes_size)"
(* timestamp operations *)
| (Add_seconds_to_timestamp, _) ->
"(Add_seconds_to_timestamp)"
| (Add_timestamp_to_seconds, _) ->
"(Add_timestamp_to_seconds)"
| (Sub_timestamp_seconds, _) ->
"(Sub_timestamp_seconds)"
| (Diff_timestamps, _) ->
"(Diff_timestamps)"
(* tez operations *)
| (Add_tez, _) ->
"(Add_tez)"
| (Sub_tez, _) ->
"(Sub_tez)"
| (Mul_teznat, _) ->
"(Mul_teznat)"
| (Mul_nattez, _) ->
"(Mul_nattez)"
| (Ediv_teznat, _) ->
"(Ediv_teznat)"
| (Ediv_tez, _) ->
"(Ediv_tez)"
(* boolean operations *)
| (Or, _) ->
"(Or)"
| (And, _) ->
"(And)"
| (Xor, _) ->
"(Xor)"
| (Not, _) ->
"(Not)"
(* integer operations *)
| (Is_nat, _) ->
"(Is_nat)"
| (Neg_nat, _) ->
"(Neg_nat)"
| (Neg_int, _) ->
"(Neg_int)"
| (Abs_int, _) ->
"(Abs_int)"
| (Int_nat, _) ->
"(Int_nat)"
| (Add_intint, _) ->
"(Add_intint)"
| (Add_intnat, _) ->
"(Add_intnat)"
| (Add_natint, _) ->
"(Add_natint)"
| (Add_natnat, _) ->
"(Add_natnat)"
| (Sub_int, _) ->
"(Sub_int)"
| (Mul_intint, _) ->
"(Mul_intint)"
| (Mul_intnat, _) ->
"(Mul_intnat)"
| (Mul_natint, _) ->
"(Mul_natint)"
| (Mul_natnat, _) ->
"(Mul_natnat)"
| (Ediv_intint, _) ->
"(Ediv_intint)"
| (Ediv_intnat, _) ->
"(Ediv_intnat)"
| (Ediv_natint, _) ->
"(Ediv_natint)"
| (Ediv_natnat, _) ->
"(Ediv_natnat)"
| (Lsl_nat, _) ->
"(Lsl_nat)"
| (Lsr_nat, _) ->
"(Lsr_nat)"
| (Or_nat, _) ->
"(Or_nat)"
| (And_nat, _) ->
"(And_nat)"
| (And_int_nat, _) ->
"(And_int_nat)"
| (Xor_nat, _) ->
"(Xor_nat)"
| (Not_nat, _) ->
"(Not_nat)"
| (Not_int, _) ->
"(Not_int)"
(* control *)
| (Seq (left, right), _) ->
Format.sprintf
"(Seq (%s) (%s))"
(serialize_descr left)
(serialize_descr right)
| (If (bl, br), _) ->
Format.sprintf
"(If_cons (%s) (%s))"
(serialize_descr bl)
(serialize_descr br)
| (Loop body, _) ->
Format.sprintf "(Loop (%s))" (serialize_descr body)
| (Loop_left body, _) ->
Format.sprintf "(Loop_left (%s))" (serialize_descr body)
| (Dip body, _) ->
Format.sprintf "(Dip (%s))" (serialize_descr body)
| (Exec, _) ->
"(Exec)"
| (Apply ty, _) ->
Format.sprintf "(Apply (%s))" (serialize_ty ty)
| (Lambda lambda, _) ->
Format.sprintf "(Apply (%s))" (serialize_lambda lambda)
| (Failwith ty, _) ->
Format.sprintf "(Failwith (%s))" (serialize_ty ty)
| (Nop, _) ->
"(Nop)"
(* comparison *)
| (Compare cty, _) ->
Format.sprintf "(Compare (%s))" (serialize_comparable_ty cty)
(* comparators *)
| (Eq, _) ->
"(Eq)"
| (Neq, _) ->
"(Neq)"
| (Lt, _) ->
"(Lt)"
| (Gt, _) ->
"(Gt)"
| (Le, _) ->
"(Le)"
| (Ge, _) ->
"(Ge)"
(* protocol *)
| (Address, _) ->
"(Address)"
| (Contract (ty, str), _) ->
Format.sprintf "(Contract (%s) (%s))" (serialize_ty ty) str
| (Transfer_tokens, _) ->
"(Transfer_tokens)"
| (Implicit_account, _) ->
"(Implicit_account)"
| (Create_contract (ty1, ty2, lambda, _), _) ->
Format.sprintf
"(Create_contract (%s) (%s) (%s))"
(serialize_ty ty1)
(serialize_ty ty2)
(serialize_lambda lambda)
| (Set_delegate, _) ->
"(Set_delegate)"
| (Now, _) ->
"(Now)"
| (Balance, _) ->
"(Balance)"
| (Level, _) ->
"(Level)"
| (Check_signature, _) ->
"(Check_signature)"
| (Hash_key, _) ->
"(Hash_key)"
| (Pack ty, _) ->
Format.sprintf "(Pack (%s))" (serialize_ty ty)
| (Unpack ty, _) ->
Format.sprintf "(Pack (%s))" (serialize_ty ty)
| (Blake2b, _) ->
"(Blake2b)"
| (Sha256, _) ->
"(Sha256)"
| (Sha512, _) ->
"(Sha512)"
| (Source, _) ->
"(Source)"
| (Sender, _) ->
"(Sender)"
| (Self (ty, str), _) ->
Format.sprintf "(Self (%s) (%s))" (serialize_ty ty) str
| (Self_address, _) ->
"(Self_address)"
| (Amount, _) ->
"(Amount)"
| (Sapling_empty_state {memo_size}, _) ->
Format.sprintf
"(Sapling_empty_state (%s)"
(Z.to_string (Sapling.Memo_size.unparse_to_z memo_size))
| (Sapling_verify_update, _) ->
"(Sapling_verify_update)"
| (Dig (int, witness), _) ->
Format.sprintf
"(Dig (%d) (%s))"
int
(serialize_stack_prefix_preservation_witness witness)
| (Dug (int, witness), _) ->
Format.sprintf
"(Dug (%d) (%s))"
int
(serialize_stack_prefix_preservation_witness witness)
| (Dipn (int, witness, descr), _) ->
Format.sprintf
"(Dipn (%d) (%s) (%s))"
int
(serialize_stack_prefix_preservation_witness witness)
(serialize_descr descr)
| (Dropn (int, witness), _) ->
Format.sprintf
"(Dropn (%d) (%s))"
int
(serialize_stack_prefix_preservation_witness witness)
| (ChainId, _) ->
"(ChainId)"
| (Never, _) ->
"(Never)"
| (Voting_power, _) ->
"(Voting_power)"
| (Total_voting_power, _) ->
"(Total_voting_power)"
| (Keccak, _) ->
"(Keccak)"
| (Sha3, _) ->
"(Sha3)"
| (Add_bls12_381_g1, _) ->
"(Add_bls12_381_g1)"
| (Add_bls12_381_g2, _) ->
"(Add_bls12_381_g2)"
| (Add_bls12_381_fr, _) ->
"(Add_bls12_381_fr)"
| (Mul_bls12_381_g1, _) ->
"(Mul_bls12_381_g1)"
| (Mul_bls12_381_g2, _) ->
"(Mul_bls12_381_g2)"
| (Mul_bls12_381_fr, _) ->
"(Mul_bls12_381_fr)"
| (Mul_bls12_381_z_fr, _) ->
"(Mul_bls12_381_z_fr)"
| (Mul_bls12_381_fr_z, _) ->
"(Mul_bls12_381_fr_z)"
| (Int_bls12_381_fr, _) ->
"(Int_bls12_381_fr)"
| (Neg_bls12_381_g1, _) ->
"(Neg_bls12_381_g1)"
| (Neg_bls12_381_g2, _) ->
"(Neg_bls12_381_g2)"
| (Neg_bls12_381_fr, _) ->
"(Neg_bls12_381_fr)"
| (Pairing_check_bls12_381, _) ->
"(Pairing_check_bls12_381)"
| (Comb (int, witness), _) ->
Format.sprintf
"(Comb (%d) (%s))"
int
(serialize_comb_gadt_witness witness)
| (Uncomb (int, witness), _) ->
Format.sprintf
"(Uncomb (%d) (%s))"
int
(serialize_uncomb_gadt_witness witness)
| (Comb_get (int, witness), _) ->
Format.sprintf
"(Comb_get (%d) (%s))"
int
(serialize_comb_get_gadt_witness witness)
| (Comb_set (int, witness), _) ->
Format.sprintf
"(Comb_set (%d) (%s))"
int
(serialize_comb_set_gadt_witness witness)
| (Dup_n (int, witness), _) ->
Format.sprintf
"(Dup_n (%d) (%s))"
int
(serialize_dup_n_gadt_witness witness)
| (Ticket, _) ->
"(Ticket)"
| (Read_ticket, _) ->
"(Read_ticket)"
| (Split_ticket, _) ->
"(Split_ticket)"
| (Join_tickets cty, _) ->
Format.sprintf "(Join_tickets (%s))" (serialize_comparable_ty cty)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment