Commit 0fc4b866 authored by Jun Furuse's avatar Jun Furuse

Binplace cleanup

parent bd5f8a93
Pipeline #100237900 passed with stage
in 7 minutes and 39 seconds
This diff is collapsed.
......@@ -46,43 +46,9 @@ let rec path i len =
if i <= nlefts then Left :: path i nlefts
else Right :: path (i - nlefts) nrights
(*
open Types
module MT = Michelson.Type
(* Obtain type encoding *)
let encode _env f t =
let open Result.Infix in
let t = Ctype.repr t in
match t.desc with
| Ttuple [] | Ttuple [_] -> assert false
| Ttuple [_; _] -> assert false (* must be handled already *)
| Ttuple ts ->
Result.mapM f ts >>= fun ts ->
let rec f = function
| Leaf ty -> ty
| Branch (t1,t2) -> MT.tyPair (f t1, f t2)
in
Ok (f & place ts)
(*
| Tconstr (p, params, _) ->
let constructors =
try
match Env.find_type_descrs p env with
| [], [] -> (* abstract *)
errorf "abstract type is not supported" (* XXX *)
| constrs, [] ->
let cs = List.map (fun c ->
let args, res = Ctype.instance_constructor c in
begin try Ctype.unify env t with _ -> assert false end;
args) constrs
in
| [], _labels -> assert false
| exception _ -> assert false (* XXX *)
in
end
*)
| _ -> Error "not supported" (* XXX *)
*)
let rec fold ~leaf ~branch = function
| Leaf ty -> leaf ty
| Branch (t1,t2) ->
let t1 = fold ~leaf ~branch t1 in
let t2 = fold ~leaf ~branch t2 in
branch t1 t2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment