diff --git a/src/haz3lweb/DebugConsole.re b/src/haz3lweb/DebugConsole.re index 8f7a0b12b0..1d61f460b2 100644 --- a/src/haz3lweb/DebugConsole.re +++ b/src/haz3lweb/DebugConsole.re @@ -16,7 +16,7 @@ let print = ({settings, editors, _}: Model.t, key: string): unit => { |> Zipper.unselect_and_zip |> ((seg: Segment.t(Uuidm.t)) => [%derive.show: Segment.t(Id.t)](seg)) |> print - | "F3" => term |> [%derive.show: UExp.t(list(Id.t))] |> print + | "F3" => term |> [%derive.show: UExp.t(IdTag.t)] |> print | "F4" => map |> Statics.Map.show |> print | "F5" => let env = Editors.get_env_init(~settings, editors); diff --git a/src/haz3lweb/Editors.re b/src/haz3lweb/Editors.re index 7b5512fc10..5f3c3ca377 100644 --- a/src/haz3lweb/Editors.re +++ b/src/haz3lweb/Editors.re @@ -66,7 +66,7 @@ let perform_action = let update_current_editor_statics = settings => update(Editor.update_statics(~settings)); -let get_ctx_init = (~settings as _: Settings.t, editors: t): Ctx.t => +let get_ctx_init = (~settings as _: Settings.t, editors: t): Ctx.t(IdTag.t) => switch (editors) { | Scratch(_) | Exercises(_) diff --git a/src/haz3lweb/view/CtxInspector.re b/src/haz3lweb/view/CtxInspector.re index 81b3050cc7..46f26c2797 100644 --- a/src/haz3lweb/view/CtxInspector.re +++ b/src/haz3lweb/view/CtxInspector.re @@ -5,7 +5,8 @@ open Util.Web; let jump_to = entry => UpdateAction.PerformAction(Jump(TileId(Haz3lcore.Ctx.get_id(entry)))); -let context_entry_view = (~inject, entry: Haz3lcore.Ctx.entry): Node.t => { +let context_entry_view = + (~inject, entry: Haz3lcore.Ctx.entry(Haz3lcore.IdTag.t)): Node.t => { let div_name = div( ~attrs=[clss(["name"]), Attr.on_click(_ => inject(jump_to(entry)))], @@ -33,7 +34,7 @@ let context_entry_view = (~inject, entry: Haz3lcore.Ctx.entry): Node.t => { }; }; -let ctx_view = (~inject, ctx: Haz3lcore.Ctx.t): Node.t => +let ctx_view = (~inject, ctx: Haz3lcore.Ctx.t(Haz3lcore.IdTag.t)): Node.t => div( ~attrs=[clss(["context-entries"])], List.map( diff --git a/src/haz3lweb/view/ExplainThis.re b/src/haz3lweb/view/ExplainThis.re index 40fc6f1b45..87d555721d 100644 --- a/src/haz3lweb/view/ExplainThis.re +++ b/src/haz3lweb/view/ExplainThis.re @@ -392,7 +392,7 @@ let example_view = ]; }; -let rec bypass_parens_and_annot_pat = (pat: Pat.t) => { +let rec bypass_parens_and_annot_pat = (pat: Pat.t(IdTag.t)) => { switch (pat.term) { | Parens(p) | Cast(p, _, _) => bypass_parens_and_annot_pat(p) @@ -400,21 +400,21 @@ let rec bypass_parens_and_annot_pat = (pat: Pat.t) => { }; }; -let rec bypass_parens_pat = (pat: Pat.t) => { +let rec bypass_parens_pat = (pat: Pat.t(IdTag.t)) => { switch (pat.term) { | Parens(p) => bypass_parens_pat(p) | _ => pat }; }; -let rec bypass_parens_exp = (exp: Exp.t(list(Id.t))) => { +let rec bypass_parens_exp = (exp: Exp.t(IdTag.t)) => { switch (exp.term) { | Parens(e) => bypass_parens_exp(e) | _ => exp }; }; -let rec bypass_parens_typ = (typ: Typ.t) => { +let rec bypass_parens_typ = (typ: Typ.t(IdTag.t)) => { switch (typ.term) { | Parens(t) => bypass_parens_typ(t) | _ => typ @@ -532,7 +532,7 @@ let get_doc = let rec get_message_exp = (term) : (list(Node.t), (list(Node.t), ColorSteps.t), list(Node.t)) => - switch ((term: Exp.term(list(Id.t)))) { + switch ((term: Exp.term(IdTag.t))) { | Exp.Invalid(_) => simple("Not a valid expression") | DynamicErrorHole(_) | FailedCast(_) @@ -542,8 +542,8 @@ let get_doc = | EmptyHole => get_message(HoleExp.empty_hole_exps) | MultiHole(_children) => get_message(HoleExp.multi_hole_exps) | TyAlias(ty_pat, ty_def, _body) => - let tpat_id = List.nth(ty_pat.ids, 0); - let def_id = List.nth(ty_def.ids, 0); + let tpat_id = List.nth(ty_pat.annotation.ids, 0); + let def_id = List.nth(ty_def.annotation.ids, 0); get_message( ~colorings= TyAliasExp.tyalias_base_exp_coloring_ids(~tpat_id, ~def_id), @@ -578,8 +578,8 @@ let get_doc = ) | TypFun(tpat, body, _) => let basic = group_id => { - let tpat_id = List.nth(tpat.ids, 0); - let body_id = List.nth(body.ids, 0); + let tpat_id = List.nth(tpat.annotation.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); get_message( ~colorings= FunctionExp.function_exp_coloring_ids( @@ -602,8 +602,8 @@ let get_doc = basic(TypFunctionExp.type_functions_basic); | Fun(pat, body, _, _) => let basic = group_id => { - let pat_id = List.nth(pat.ids, 0); - let body_id = List.nth(body.ids, 0); + let pat_id = List.nth(pat.annotation.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); get_message( ~colorings= FunctionExp.function_exp_coloring_ids(~pat_id, ~body_id), @@ -620,8 +620,8 @@ let get_doc = ); }; let pat = bypass_parens_and_annot_pat(pat); - let pat_id = List.nth(pat.ids, 0); - let body_id = List.nth(body.ids, 0); + let pat_id = List.nth(pat.annotation.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); switch (pat.term) { | EmptyHole => if (FunctionExp.function_empty_hole_exp.id @@ -864,8 +864,8 @@ let get_doc = | Cons(hd, tl) => if (FunctionExp.function_cons_exp.id == get_specificity_level(FunctionExp.functions_cons)) { - let hd_id = List.nth(hd.ids, 0); - let tl_id = List.nth(tl.ids, 0); + let hd_id = List.nth(hd.annotation.ids, 0); + let tl_id = List.nth(tl.annotation.ids, 0); get_message( ~colorings= FunctionExp.function_cons_exp_coloring_ids( @@ -910,8 +910,8 @@ let get_doc = basic(FunctionExp.functions_var); } | Tuple(elements) => - let pat_id = List.nth(pat.ids, 0); - let body_id = List.nth(body.ids, 0); + let pat_id = List.nth(pat.annotation.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); let basic_tuple = group_id => { get_message( ~colorings= @@ -938,8 +938,10 @@ let get_doc = | 2 => let doc_id = get_specificity_level(FunctionExp.functions_tuple2); if (FunctionExp.function_tuple2_exp.id == doc_id) { - let pat1_id = List.nth(List.nth(elements, 0).ids, 0); - let pat2_id = List.nth(List.nth(elements, 1).ids, 0); + let pat1_id = + List.nth(List.nth(elements, 0).annotation.ids, 0); + let pat2_id = + List.nth(List.nth(elements, 1).annotation.ids, 0); get_message( ~colorings= FunctionExp.function_tuple2_exp_coloring_ids( @@ -967,9 +969,12 @@ let get_doc = | 3 => let doc_id = get_specificity_level(FunctionExp.functions_tuple3); if (FunctionExp.function_tuple3_exp.id == doc_id) { - let pat1_id = List.nth(List.nth(elements, 0).ids, 0); - let pat2_id = List.nth(List.nth(elements, 1).ids, 0); - let pat3_id = List.nth(List.nth(elements, 2).ids, 0); + let pat1_id = + List.nth(List.nth(elements, 0).annotation.ids, 0); + let pat2_id = + List.nth(List.nth(elements, 1).annotation.ids, 0); + let pat3_id = + List.nth(List.nth(elements, 2).annotation.ids, 0); get_message( ~colorings= FunctionExp.function_tuple3_exp_coloring_ids( @@ -1007,8 +1012,8 @@ let get_doc = | Ap(con, arg) => if (FunctionExp.function_ap_exp.id == get_specificity_level(FunctionExp.functions_ap)) { - let con_id = List.nth(con.ids, 0); - let arg_id = List.nth(arg.ids, 0); + let con_id = List.nth(con.annotation.ids, 0); + let arg_id = List.nth(arg.annotation.ids, 0); get_message( ~colorings= FunctionExp.function_ap_exp_coloring_ids( @@ -1034,8 +1039,8 @@ let get_doc = | Constructor(v, _) => if (FunctionExp.function_ctr_exp.id == get_specificity_level(FunctionExp.functions_ctr)) { - let pat_id = List.nth(pat.ids, 0); - let body_id = List.nth(body.ids, 0); + let pat_id = List.nth(pat.annotation.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); get_message( ~colorings= FunctionExp.function_ctr_exp_coloring_ids(~pat_id, ~body_id), @@ -1076,8 +1081,8 @@ let get_doc = | 2 => if (TupleExp.tuple_exp_size2.id == get_specificity_level(TupleExp.tuples2)) { - let exp1_id = List.nth(List.nth(terms, 0).ids, 0); - let exp2_id = List.nth(List.nth(terms, 1).ids, 0); + let exp1_id = List.nth(List.nth(terms, 0).annotation.ids, 0); + let exp2_id = List.nth(List.nth(terms, 1).annotation.ids, 0); get_message( ~colorings= TupleExp.tuple_exp_size2_coloring_ids(~exp1_id, ~exp2_id), @@ -1098,9 +1103,9 @@ let get_doc = | 3 => if (TupleExp.tuple_exp_size3.id == get_specificity_level(TupleExp.tuples3)) { - let exp1_id = List.nth(List.nth(terms, 0).ids, 0); - let exp2_id = List.nth(List.nth(terms, 1).ids, 0); - let exp3_id = List.nth(List.nth(terms, 2).ids, 0); + let exp1_id = List.nth(List.nth(terms, 0).annotation.ids, 0); + let exp2_id = List.nth(List.nth(terms, 1).annotation.ids, 0); + let exp3_id = List.nth(List.nth(terms, 2).annotation.ids, 0); get_message( ~colorings= TupleExp.tuple_exp_size3_coloring_ids( @@ -1128,9 +1133,9 @@ let get_doc = | Var(n) => get_message(TerminalExp.var_exps(n)) | Let(pat, def, body) => let pat = bypass_parens_and_annot_pat(pat); - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); + let pat_id = List.nth(pat.annotation.ids, 0); + let def_id = List.nth(def.annotation.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); let basic = group_id => { get_message( ~colorings=LetExp.let_base_exp_coloring_ids(~pat_id, ~def_id), @@ -1387,8 +1392,8 @@ let get_doc = | Cons(hd, tl) => if (LetExp.let_cons_exp.id == get_specificity_level(LetExp.lets_cons)) { - let hd_id = List.nth(hd.ids, 0); - let tl_id = List.nth(tl.ids, 0); + let hd_id = List.nth(hd.annotation.ids, 0); + let tl_id = List.nth(tl.annotation.ids, 0); get_message( ~colorings= LetExp.let_cons_exp_coloring_ids(~hd_id, ~tl_id, ~def_id), @@ -1450,8 +1455,10 @@ let get_doc = | 2 => let doc_id = get_specificity_level(LetExp.lets_tuple2); if (LetExp.let_tuple2_exp.id == doc_id) { - let pat1_id = List.nth(List.nth(elements, 0).ids, 0); - let pat2_id = List.nth(List.nth(elements, 1).ids, 0); + let pat1_id = + List.nth(List.nth(elements, 0).annotation.ids, 0); + let pat2_id = + List.nth(List.nth(elements, 1).annotation.ids, 0); get_message( ~colorings= LetExp.let_tuple2_exp_coloring_ids( @@ -1480,9 +1487,12 @@ let get_doc = let doc_id = get_specificity_level(LetExp.lets_tuple3); // TODO Syntactic form can go off page - so can examples - but can scroll, just can't see bottom scroll bar if (LetExp.let_tuple3_exp.id == doc_id) { - let pat1_id = List.nth(List.nth(elements, 0).ids, 0); - let pat2_id = List.nth(List.nth(elements, 1).ids, 0); - let pat3_id = List.nth(List.nth(elements, 2).ids, 0); + let pat1_id = + List.nth(List.nth(elements, 0).annotation.ids, 0); + let pat2_id = + List.nth(List.nth(elements, 1).annotation.ids, 0); + let pat3_id = + List.nth(List.nth(elements, 2).annotation.ids, 0); get_message( ~colorings= LetExp.let_tuple3_exp_coloring_ids( @@ -1519,8 +1529,8 @@ let get_doc = }; | Ap(con, arg) => if (LetExp.let_ap_exp.id == get_specificity_level(LetExp.lets_ap)) { - let con_id = List.nth(con.ids, 0); - let arg_id = List.nth(arg.ids, 0); + let con_id = List.nth(con.annotation.ids, 0); + let arg_id = List.nth(arg.annotation.ids, 0); get_message( ~colorings= LetExp.let_ap_exp_coloring_ids(~con_id, ~arg_id, ~def_id), @@ -1580,8 +1590,8 @@ let get_doc = ), ) | TypAp(f, typ) => - let f_id = List.nth(f.ids, 0); - let typ_id = List.nth(typ.ids, 0); + let f_id = List.nth(f.annotation.ids, 0); + let typ_id = List.nth(typ.annotation.ids, 0); let basic = (group, format, coloring_ids) => { get_message( ~colorings=coloring_ids(~f_id, ~typ_id), @@ -1601,8 +1611,8 @@ let get_doc = ); | Ap(Forward, x, arg) => - let x_id = List.nth(x.ids, 0); - let arg_id = List.nth(arg.ids, 0); + let x_id = List.nth(x.annotation.ids, 0); + let arg_id = List.nth(arg.annotation.ids, 0); let basic = (group, format, coloring_ids) => { get_message( ~colorings=coloring_ids(~x_id, ~arg_id), @@ -1636,11 +1646,11 @@ let get_doc = ) }; | DeferredAp(x, args) => - let x_id = List.nth(x.ids, 0); + let x_id = List.nth(x.annotation.ids, 0); let supplied_id = Id.mk(); let deferred_id = { let deferral = List.find(Exp.is_deferral, args); - List.nth(deferral.ids, 0); + List.nth(deferral.annotation.ids, 0); }; switch (mode) { | MessageContent(_) => @@ -1663,8 +1673,8 @@ let get_doc = let color_fn = List.nth(ColorSteps.child_colors, 0); let color_supplied = List.nth(ColorSteps.child_colors, 1); let color_deferred = List.nth(ColorSteps.child_colors, 2); - let add = (mapping, arg: Exp.t(list(Id.t))) => { - let arg_id = List.nth(arg.ids, 0); + let add = (mapping, arg: Exp.t(IdTag.t)) => { + let arg_id = List.nth(arg.annotation.ids, 0); Haz3lcore.Id.Map.add( arg_id, Exp.is_deferral(arg) ? color_deferred : color_supplied, @@ -1677,9 +1687,9 @@ let get_doc = ([], ([], color_map), []); }; | If(cond, then_, else_) => - let cond_id = List.nth(cond.ids, 0); - let then_id = List.nth(then_.ids, 0); - let else_id = List.nth(else_.ids, 0); + let cond_id = List.nth(cond.annotation.ids, 0); + let then_id = List.nth(then_.annotation.ids, 0); + let else_id = List.nth(else_.annotation.ids, 0); get_message( ~colorings=IfExp.if_exp_coloring_ids(~cond_id, ~then_id, ~else_id), ~format= @@ -1695,8 +1705,8 @@ let get_doc = IfExp.ifs, ); | Seq(left, right) => - let exp1_id = List.nth(left.ids, 0); - let exp2_id = List.nth(right.ids, 0); + let exp1_id = List.nth(left.annotation.ids, 0); + let exp2_id = List.nth(right.annotation.ids, 0); get_message( ~colorings=SeqExp.seq_exp_coloring_ids(~exp1_id, ~exp2_id), ~format= @@ -1740,7 +1750,7 @@ let get_doc = ) | Filter(_) => simple("Internal expression") | Test(body) => - let body_id = List.nth(body.ids, 0); + let body_id = List.nth(body.annotation.ids, 0); get_message( ~colorings=TestExp.test_exp_coloring_ids(~body_id), ~format= @@ -1755,8 +1765,8 @@ let get_doc = ); | Parens(term) => get_message_exp(term.term) // No Special message? | Cons(hd, tl) => - let hd_id = List.nth(hd.ids, 0); - let tl_id = List.nth(tl.ids, 0); + let hd_id = List.nth(hd.annotation.ids, 0); + let tl_id = List.nth(tl.annotation.ids, 0); get_message( ~colorings=ListExp.cons_exp_coloring_ids(~hd_id, ~tl_id), ~format= @@ -1771,8 +1781,8 @@ let get_doc = ListExp.listcons, ); | ListConcat(xs, ys) => - let xs_id = List.nth(xs.ids, 0); - let ys_id = List.nth(ys.ids, 0); + let xs_id = List.nth(xs.annotation.ids, 0); + let ys_id = List.nth(ys.annotation.ids, 0); get_message( ~colorings=ListExp.concat_exp_coloring_ids(~xs_id, ~ys_id), ~format= @@ -1789,7 +1799,7 @@ let get_doc = | UnOp(op, exp) => switch (op) { | Bool(Not) => - let exp_id = List.nth(exp.ids, 0); + let exp_id = List.nth(exp.annotation.ids, 0); get_message( ~colorings=OpExp.bool_unary_not_exp_coloring_ids(~exp_id), ~format= @@ -1803,7 +1813,7 @@ let get_doc = OpExp.bool_un_not, ); | Int(Minus) => - let exp_id = List.nth(exp.ids, 0); + let exp_id = List.nth(exp.annotation.ids, 0); get_message( ~colorings=OpExp.int_unary_minus_exp_coloring_ids(~exp_id), ~format= @@ -1865,8 +1875,8 @@ let get_doc = | String(Equals) => (string_equal, str_eq_exp_coloring_ids) | String(Concat) => (string_concat, str_concat_exp_coloring_ids) }; - let left_id = List.nth(left.ids, 0); - let right_id = List.nth(right.ids, 0); + let left_id = List.nth(left.annotation.ids, 0); + let right_id = List.nth(right.annotation.ids, 0); get_message( ~colorings=coloring_ids(~left_id, ~right_id), ~format= @@ -1881,7 +1891,7 @@ let get_doc = group, ); | Match(scrut, _rules) => - let scrut_id = List.nth(scrut.ids, 0); + let scrut_id = List.nth(scrut.annotation.ids, 0); get_message( ~colorings=CaseExp.case_exp_coloring_ids(~scrut_id), ~format= @@ -1963,8 +1973,8 @@ let get_doc = ); } | Cons(hd, tl) => - let hd_id = List.nth(hd.ids, 0); - let tl_id = List.nth(tl.ids, 0); + let hd_id = List.nth(hd.annotation.ids, 0); + let tl_id = List.nth(tl.annotation.ids, 0); let basic = doc => get_message( ~colorings=ListPat.cons_base_pat_coloring_ids(~hd_id, ~tl_id), @@ -1982,8 +1992,8 @@ let get_doc = switch (tl.term) { | Pat.Cons(hd2, tl2) => if (ListPat.cons2_pat.id == get_specificity_level(ListPat.cons2)) { - let hd2_id = List.nth(hd2.ids, 0); - let tl2_id = List.nth(tl2.ids, 0); + let hd2_id = List.nth(hd2.annotation.ids, 0); + let tl2_id = List.nth(tl2.annotation.ids, 0); get_message( ~colorings= ListPat.cons2_pat_coloring_ids( @@ -2033,8 +2043,8 @@ let get_doc = | 2 => if (TuplePat.tuple_pat_size2.id == get_specificity_level(TuplePat.tuple2)) { - let elem1_id = List.nth(List.nth(elements, 0).ids, 0); - let elem2_id = List.nth(List.nth(elements, 1).ids, 0); + let elem1_id = List.nth(List.nth(elements, 0).annotation.ids, 0); + let elem2_id = List.nth(List.nth(elements, 1).annotation.ids, 0); get_message( ~colorings= TuplePat.tuple_pat_size2_coloring_ids(~elem1_id, ~elem2_id), @@ -2055,9 +2065,9 @@ let get_doc = | 3 => if (TuplePat.tuple_pat_size3.id == get_specificity_level(TuplePat.tuple3)) { - let elem1_id = List.nth(List.nth(elements, 0).ids, 0); - let elem2_id = List.nth(List.nth(elements, 1).ids, 0); - let elem3_id = List.nth(List.nth(elements, 2).ids, 0); + let elem1_id = List.nth(List.nth(elements, 0).annotation.ids, 0); + let elem2_id = List.nth(List.nth(elements, 1).annotation.ids, 0); + let elem3_id = List.nth(List.nth(elements, 2).annotation.ids, 0); get_message( ~colorings= TuplePat.tuple_pat_size3_coloring_ids( @@ -2083,8 +2093,8 @@ let get_doc = | _ => basic(TuplePat.tuple) }; | Ap(con, arg) => - let con_id = List.nth(con.ids, 0); - let arg_id = List.nth(arg.ids, 0); + let con_id = List.nth(con.annotation.ids, 0); + let arg_id = List.nth(arg.annotation.ids, 0); get_message( ~colorings=AppPat.ap_pat_coloring_ids(~con_id, ~arg_id), ~format= @@ -2107,8 +2117,8 @@ let get_doc = TerminalPat.ctr(con), ) | Cast(pat, typ, _) => - let pat_id = List.nth(pat.ids, 0); - let typ_id = List.nth(typ.ids, 0); + let pat_id = List.nth(pat.annotation.ids, 0); + let typ_id = List.nth(typ.annotation.ids, 0); get_message( ~colorings=TypAnnPat.typann_pat_coloring_ids(~pat_id, ~typ_id), ~format= @@ -2138,7 +2148,7 @@ let get_doc = | Bool => get_message(TerminalTyp.bool) | String => get_message(TerminalTyp.str) | List(elem) => - let elem_id = List.nth(elem.ids, 0); + let elem_id = List.nth(elem.annotation.ids, 0); get_message( ~colorings=ListTyp.list_typ_coloring_ids(~elem_id), ~format= @@ -2152,8 +2162,8 @@ let get_doc = ListTyp.list, ); | Forall(tpat, typ) => - let tpat_id = List.nth(tpat.ids, 0); - let tbody_id = List.nth(typ.ids, 0); + let tpat_id = List.nth(tpat.annotation.ids, 0); + let tbody_id = List.nth(typ.annotation.ids, 0); get_message( ~colorings=ForallTyp.forall_typ_coloring_ids(~tpat_id, ~tbody_id), ~format= @@ -2168,8 +2178,8 @@ let get_doc = ForallTyp.forall, ); | Rec(tpat, typ) => - let tpat_id = List.nth(tpat.ids, 0); - let tbody_id = List.nth(typ.ids, 0); + let tpat_id = List.nth(tpat.annotation.ids, 0); + let tbody_id = List.nth(typ.annotation.ids, 0); get_message( ~colorings=RecTyp.rec_typ_coloring_ids(~tpat_id, ~tbody_id), ~format= @@ -2184,8 +2194,8 @@ let get_doc = RecTyp.rec_, ); | Arrow(arg, result) => - let arg_id = List.nth(arg.ids, 0); - let result_id = List.nth(result.ids, 0); + let arg_id = List.nth(arg.annotation.ids, 0); + let result_id = List.nth(result.annotation.ids, 0); let basic = doc => get_message( ~colorings=ArrowTyp.arrow_typ_coloring_ids(~arg_id, ~result_id), @@ -2203,8 +2213,8 @@ let get_doc = switch (result.term) { | Typ.Arrow(arg2, result2) => if (ArrowTyp.arrow3_typ.id == get_specificity_level(ArrowTyp.arrow3)) { - let arg2_id = List.nth(arg2.ids, 0); - let result2_id = List.nth(result2.ids, 0); + let arg2_id = List.nth(arg2.annotation.ids, 0); + let result2_id = List.nth(result2.annotation.ids, 0); get_message( ~colorings= ArrowTyp.arrow3_typ_coloring_ids( @@ -2255,8 +2265,8 @@ let get_doc = } | 2 => if (TupleTyp.tuple2_typ.id == get_specificity_level(TupleTyp.tuple2)) { - let elem1_id = List.nth(List.nth(elements, 0).ids, 0); - let elem2_id = List.nth(List.nth(elements, 1).ids, 0); + let elem1_id = List.nth(List.nth(elements, 0).annotation.ids, 0); + let elem2_id = List.nth(List.nth(elements, 1).annotation.ids, 0); get_message( ~colorings=TupleTyp.tuple2_typ_coloring_ids(~elem1_id, ~elem2_id), ~format= @@ -2275,9 +2285,9 @@ let get_doc = } | 3 => if (TupleTyp.tuple3_typ.id == get_specificity_level(TupleTyp.tuple3)) { - let elem1_id = List.nth(List.nth(elements, 0).ids, 0); - let elem2_id = List.nth(List.nth(elements, 1).ids, 0); - let elem3_id = List.nth(List.nth(elements, 2).ids, 0); + let elem1_id = List.nth(List.nth(elements, 0).annotation.ids, 0); + let elem2_id = List.nth(List.nth(elements, 1).annotation.ids, 0); + let elem3_id = List.nth(List.nth(elements, 2).annotation.ids, 0); get_message( ~colorings= TupleTyp.tuple3_typ_coloring_ids( diff --git a/src/haz3lweb/view/Kind.re b/src/haz3lweb/view/Kind.re index 8feb3af0b0..a13659f229 100644 --- a/src/haz3lweb/view/Kind.re +++ b/src/haz3lweb/view/Kind.re @@ -2,7 +2,7 @@ open Virtual_dom.Vdom; open Node; open Util.Web; -let view = (kind: Haz3lcore.Ctx.kind): Node.t => +let view = (kind: Haz3lcore.Ctx.kind(Haz3lcore.IdTag.t)): Node.t => switch (kind) { | Singleton(ty) => div_c("kind-view", [Type.view(ty)]) | Abstract => div_c("kind-view", [text("Type")]) diff --git a/src/haz3lweb/view/Type.re b/src/haz3lweb/view/Type.re index 4ee4f29af2..cb9d9b0144 100644 --- a/src/haz3lweb/view/Type.re +++ b/src/haz3lweb/view/Type.re @@ -3,7 +3,7 @@ open Node; open Util.Web; open Haz3lcore; -let tpat_view = (tpat: Haz3lcore.TPat.t): string => +let tpat_view = (tpat: Haz3lcore.TPat.t('a)): string => switch (tpat.term) { | Var(x) => x | _ => "?" @@ -15,13 +15,14 @@ let ty_view = (cls: string, s: string): Node.t => let alias_view = (s: string): Node.t => div(~attrs=[clss(["typ-alias-view"])], [text(s)]); -let rec view_ty = (~strip_outer_parens=false, ty: Haz3lcore.Typ.t): Node.t => +let rec view_ty = + (~strip_outer_parens=false, ty: Haz3lcore.Typ.t(IdTag.t)): Node.t => switch (Typ.term_of(ty)) { | Unknown(prov) => div( ~attrs=[ clss(["typ-view", "atom", "unknown"]), - Attr.title(Typ.show_type_provenance(prov)), + Attr.title([%derive.show: Typ.type_provenance(IdTag.t)](prov)), ], [text("?") /*, prov_view(prov)*/], ) @@ -98,7 +99,7 @@ let rec view_ty = (~strip_outer_parens=false, ty: Haz3lcore.Typ.t): Node.t => div( ~attrs=[ clss(["typ-view", "atom", "unknown"]), - Attr.title(Typ.show_type_provenance(Internal)), + Attr.title([%derive.show: Typ.type_provenance(IdTag.t)](Internal)), ], [text("?") /*, prov_view(prov)*/], ) @@ -120,5 +121,5 @@ and paren_view = typ => [view_ty(typ)]; }; -let view = (ty: Haz3lcore.Typ.t): Node.t => +let view = (ty: Haz3lcore.Typ.t(IdTag.t)): Node.t => div_c("typ-wrapper", [view_ty(ty)]); diff --git a/src/haz3lweb/view/dhcode/DHCode.re b/src/haz3lweb/view/dhcode/DHCode.re index cdb22187a5..231341e262 100644 --- a/src/haz3lweb/view/dhcode/DHCode.re +++ b/src/haz3lweb/view/dhcode/DHCode.re @@ -135,7 +135,7 @@ let view = ~next_steps: list((int, Id.t))=[], ~result_key: string, ~infomap, - d: DHExp.t(list(Id.t)), + d: DHExp.t(IdTag.t), ) : Node.t => { DHDoc_Exp.mk( diff --git a/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re b/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re index dd08c99475..9b0a08a773 100644 --- a/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re +++ b/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re @@ -42,7 +42,7 @@ let precedence_bin_string_op = (bso: Operators.op_bin_string) => | Concat => DHDoc_common.precedence_Plus | Equals => DHDoc_common.precedence_Equals }; -let rec precedence = (~show_casts: bool, d: DHExp.t(list(Id.t))) => { +let rec precedence = (~show_casts: bool, d: DHExp.t(IdTag.t)) => { let precedence' = precedence(~show_casts); switch (DHExp.term_of(d)) { | Var(_) @@ -114,13 +114,13 @@ let mk = ~next_steps: list((int, Id.t)), // The options for the next step, if it hasn't been chosen yet ~env: ClosureEnvironment.t, ~infomap: Statics.Map.t, - d: DHExp.t(list(Id.t)), + d: DHExp.t(IdTag.t), ) : DHDoc.t => { let precedence = precedence(~show_casts=settings.show_casts); let rec go = ( - d: DHExp.t(list(Id.t)), + d: DHExp.t(IdTag.t), env: ClosureEnvironment.t, enforce_inline: bool, recent_subst: list(Var.t), diff --git a/src/haz3lweb/view/dhcode/layout/DHDoc_Pat.re b/src/haz3lweb/view/dhcode/layout/DHDoc_Pat.re index 8996bd4b03..c08ab11e5c 100644 --- a/src/haz3lweb/view/dhcode/layout/DHDoc_Pat.re +++ b/src/haz3lweb/view/dhcode/layout/DHDoc_Pat.re @@ -1,7 +1,7 @@ open Pretty; open Haz3lcore; -let precedence = (dp: Pat.t) => +let precedence = (dp: Pat.t(IdTag.t)) => switch (DHPat.term_of(dp)) { | EmptyHole | MultiHole(_) @@ -27,7 +27,7 @@ let rec mk = ~parenthesize=false, ~show_casts, ~enforce_inline: bool, - dp: Pat.t, + dp: Pat.t(IdTag.t), ) : DHDoc.t => { let mk' = mk(~enforce_inline, ~infomap, ~show_casts); diff --git a/src/haz3lweb/view/dhcode/layout/DHDoc_Typ.re b/src/haz3lweb/view/dhcode/layout/DHDoc_Typ.re index 143e36d3e3..73e54b8c2c 100644 --- a/src/haz3lweb/view/dhcode/layout/DHDoc_Typ.re +++ b/src/haz3lweb/view/dhcode/layout/DHDoc_Typ.re @@ -8,5 +8,5 @@ let promote_annot = | HTypAnnot.HoleLabel => DHAnnot.HoleLabel | HTypAnnot.Delim => DHAnnot.Delim; let promote = (d: HTypDoc.t): DHDoc.t => d |> Doc.map_annot(promote_annot); -let mk = (~enforce_inline: bool, ty: Typ.t): DHDoc.t => +let mk = (~enforce_inline: bool, ty: Typ.t(IdTag.t)): DHDoc.t => ty |> HTypDoc.mk(~enforce_inline) |> promote; diff --git a/src/haz3lweb/view/dhcode/layout/HTypDoc.re b/src/haz3lweb/view/dhcode/layout/HTypDoc.re index 996d01f607..f616e7f9c2 100644 --- a/src/haz3lweb/view/dhcode/layout/HTypDoc.re +++ b/src/haz3lweb/view/dhcode/layout/HTypDoc.re @@ -12,7 +12,7 @@ let precedence_Sum = 3; let precedence_Ap = 4; let precedence_Const = 5; -let precedence = (ty: Typ.t): int => +let precedence = (ty: Typ.t(IdTag.t)): int => switch (Typ.term_of(ty)) { | Int | Float @@ -51,7 +51,8 @@ let pad_child = let mk_delim = s => Doc.(annot(HTypAnnot.Delim, text(s))); -let rec mk = (~parenthesize=false, ~enforce_inline: bool, ty: Typ.t): t => { +let rec mk = + (~parenthesize=false, ~enforce_inline: bool, ty: Typ.t(IdTag.t)): t => { open Doc; let mk' = mk(~enforce_inline); let mk_right_associative_operands = (precedence_op, ty1, ty2) => ( diff --git a/src/haz3lweb/view/dhcode/layout/HTypDoc.rei b/src/haz3lweb/view/dhcode/layout/HTypDoc.rei index ab07b0e81e..2253bed749 100644 --- a/src/haz3lweb/view/dhcode/layout/HTypDoc.rei +++ b/src/haz3lweb/view/dhcode/layout/HTypDoc.rei @@ -2,4 +2,4 @@ open Haz3lcore; type t = Pretty.Doc.t(HTypAnnot.t); -let mk: (~parenthesize: bool=?, ~enforce_inline: bool, Typ.t) => t; +let mk: (~parenthesize: bool=?, ~enforce_inline: bool, Typ.t(IdTag.t)) => t;