Skip to content
Open
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
a649815
Add DynType projector
7h3kk1d Aug 3, 2025
1a40403
Add shortcut for Dynamic Type with alt+d hotkey
7h3kk1d Aug 5, 2025
0216699
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 6, 2025
65d1851
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 12, 2025
3d15477
Add Typ.consistent_join for the dyntype projector
7h3kk1d Aug 12, 2025
36d615c
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 20, 2025
85c2b4d
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 20, 2025
7909c30
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 21, 2025
88e8d76
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 26, 2025
1e5f9ca
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 28, 2025
db3a420
Merge branch 'dev' into dyntype-proj
7h3kk1d Aug 29, 2025
3961c95
Merge branch 'dev' into dyntype-proj
7h3kk1d Sep 3, 2025
853e029
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Sep 12, 2025
be3aa4d
Merge branch 'dev' into dyntype-proj
7h3kk1d Sep 18, 2025
72e8101
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Sep 24, 2025
a82b64c
temp
7h3kk1d Sep 24, 2025
b7c2577
Merge branch '1966-no-probed-values' into dyntype-type-proj
7h3kk1d Sep 24, 2025
0dd5810
Type probe on types
7h3kk1d Sep 25, 2025
173a5f4
Remove projector parsing tests
7h3kk1d Sep 25, 2025
6e4de9c
Add type handling for Typ in probe
7h3kk1d Sep 25, 2025
353b0e2
Implement dynamic type handling in type projector
7h3kk1d Sep 29, 2025
4c6658c
Crude styling of dynamic types in type projector
7h3kk1d Sep 29, 2025
4d386e8
Mark unused patterns
7h3kk1d Sep 29, 2025
d8efcfd
Remove dynamic type projector
7h3kk1d Sep 29, 2025
9a8e9f6
Types can show their types
7h3kk1d Sep 29, 2025
9ab6e0c
Inefficient adding of dynamic types to cursor inspector
7h3kk1d Oct 2, 2025
ff67c1f
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Oct 6, 2025
2ea4c26
Merge remote-tracking branch 'origin/dyntype-proj' into dyntype-type-…
7h3kk1d Oct 6, 2025
930e42f
Fix transition_multiple call to include update_probe parameter
7h3kk1d Oct 10, 2025
e1539bc
Merge branch 'dev' into dyntype-proj
7h3kk1d Oct 17, 2025
75666d3
Merge remote-tracking branch 'origin/dev' into dyntype-type-proj
7h3kk1d Oct 17, 2025
2585f43
Address merge errors
7h3kk1d Oct 17, 2025
bbf9abf
Merge remote-tracking branch 'origin/dyntype-proj' into dyntype-type-…
7h3kk1d Oct 17, 2025
10a2850
Merge branch 'dev' into dyntype-proj
7h3kk1d Oct 21, 2025
bd8fd25
Merge branch 'dyntype-proj' into dyntype-type-proj
7h3kk1d Oct 21, 2025
d1e8ce3
Merge branch 'dev' into dyntype-proj
7h3kk1d Oct 23, 2025
c9d7cf2
Merge branch 'dev' into dyntype-proj
7h3kk1d Oct 30, 2025
b0b4285
Merge remote-tracking branch 'origin/dyntype-proj' into dyntype-type-…
7h3kk1d Oct 30, 2025
b08f6a1
Fix probe collection for types
7h3kk1d Nov 4, 2025
2e5350a
add WriterMonad
7h3kk1d Nov 4, 2025
941e249
Use writer monad in ascriptions transition
7h3kk1d Nov 4, 2025
d6c64e2
Only probe unknown expressions when dynamic_feedback is enabled
7h3kk1d Oct 16, 2025
e4a0034
Fix ascriptions transition hallucination by ai
7h3kk1d Nov 4, 2025
06902fc
Fix if statement ascription transition
7h3kk1d Nov 4, 2025
e08aa02
Remove debug print statement from ascriptions transition
7h3kk1d Nov 4, 2025
3c3eac3
Merge branch 'dev' into dyntype-proj
7h3kk1d Nov 10, 2025
bf5a0d2
Merge branch 'dyntype-proj' into dyntype-type-proj
7h3kk1d Nov 10, 2025
a3cf6dc
Remove debug print statement for dynamic ID check
7h3kk1d Nov 10, 2025
2dbf027
Stop doing ascription transition in labeled tuple entries unboxing
7h3kk1d Nov 10, 2025
df49af0
Revert Id show to full id
7h3kk1d Nov 10, 2025
8e2a70a
Revert IdTagged pp changes
7h3kk1d Nov 10, 2025
5b1c7d3
add Probe to Typ.cls
7h3kk1d Nov 10, 2025
5ff56a7
Remove comments
7h3kk1d Nov 10, 2025
7b34b49
Add documentation for probe_unknowns parameter in Elaborator
7h3kk1d Nov 10, 2025
c76a164
Disable type projector on types for now
7h3kk1d Nov 10, 2025
995b9af
Revert codeeditable and cursorinspector changes
7h3kk1d Nov 10, 2025
4ec5c6d
Fix syn display for typ proj
7h3kk1d Nov 10, 2025
30f5593
feat(typeproj): enhance toggle display logic for expected types
7h3kk1d Nov 10, 2025
698e981
Fix typ diff styling
7h3kk1d Nov 19, 2025
64d6aa6
Improve pad ids documentation
7h3kk1d Nov 19, 2025
c270918
add test for no difference between identical types
7h3kk1d Nov 19, 2025
e4e1a7c
feat(projectors): add Typ handling to type projector
7h3kk1d Nov 19, 2025
f1eea2e
refactor(elaborate): remove unused fix_typ_ids function and simplify …
7h3kk1d Nov 19, 2025
222abd1
fix(diff): clarify assumption about distinct initial ids in diff func…
7h3kk1d Nov 19, 2025
d5a0291
Fix typ.diff for recursive types and forall types
7h3kk1d Nov 19, 2025
9b1af01
Remove duplicate test
7h3kk1d Nov 19, 2025
ff5523b
Probes and dyntype probes on types (#1969)
7h3kk1d Nov 19, 2025
0f20fd1
refactor(diff): simplify testable function usage in diff tests
7h3kk1d Nov 19, 2025
c7d0ce2
refactor(Typ): abandon consistent_join
7h3kk1d Nov 19, 2025
52d2a2c
refactor(ProjectorCore): simplify name lookup using StringMap
7h3kk1d Nov 19, 2025
15a8df2
refactor(Test_Typ): remove redundant testable_typ variable
7h3kk1d Nov 19, 2025
c2b73ee
Fix assertion description
7h3kk1d Nov 20, 2025
1d1ff55
Fix typeproj dynamic type styling
7h3kk1d Nov 20, 2025
a324d73
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Nov 26, 2025
7e12fdd
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Nov 26, 2025
5c85788
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Feb 2, 2026
e4b95b2
More fixes
7h3kk1d Feb 2, 2026
10c26b3
Fix compilation
7h3kk1d Feb 3, 2026
79cf327
progress
7h3kk1d Feb 3, 2026
c733274
Add type probe recording for ascriptions and update test description
7h3kk1d Feb 3, 2026
aa26613
Record type samples during ascription transitions
7h3kk1d Feb 3, 2026
f6d3975
Fix type projector mode switching Failure(nth) exception
github-actions[bot] Feb 3, 2026
7f821c9
Use refractor id instead of projector in set model
7h3kk1d Feb 3, 2026
d8b16b2
Revert unnecessary changes
7h3kk1d Feb 3, 2026
4e6c1ae
Add type probe tests
7h3kk1d Feb 3, 2026
ee65e54
Preserve Parens ID during normalization for accurate type probes
7h3kk1d Feb 3, 2026
94ab61a
Type probe fixes
7h3kk1d Feb 3, 2026
14c1ed0
Merge branch 'dev' into dyntype-proj
7h3kk1d Feb 3, 2026
5c4fcb2
Rip out probes on types
7h3kk1d Feb 4, 2026
5d94433
Remove probe_unknowns from elaborator
7h3kk1d Feb 4, 2026
9ab851d
Revert extraneous changes
7h3kk1d Feb 4, 2026
457534b
Remove WriterMonad module
7h3kk1d Feb 4, 2026
e50c2c5
Update probes doc buffer to have a from_lvs example for dynamic type …
7h3kk1d Feb 4, 2026
c37c8e0
Merge remote-tracking branch 'origin/dev' into dyntype-proj
7h3kk1d Feb 6, 2026
23e38c3
Update context menu labels for type probe actions
7h3kk1d Feb 10, 2026
2620112
Merge branch 'dev' into dyntype-proj
7h3kk1d Feb 10, 2026
4ae0e2c
Add hover tooltip for type probe mode
7h3kk1d Feb 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CLI/Print.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let exp_to_segment_settings: ExpToSegment.Settings.t = {
hide_fixpoints: false,
show_filters: true,
show_unknown_as_hole: true,
raise_if_padding: false,
};

let segmentize =
Expand Down
12 changes: 11 additions & 1 deletion src/haz3lcore/pretty/ExpToSegment.re
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module Settings = {
hide_fixpoints: bool,
show_filters: bool,
show_unknown_as_hole: bool,
raise_if_padding: bool,
};

let of_core = (~inline, ~fold_fn_bodies=?, settings: CoreSettings.t) => {
Expand All @@ -59,6 +60,7 @@ module Settings = {
hide_fixpoints: !settings.evaluation.show_fixpoints,
show_filters: settings.evaluation.show_stepper_filters,
show_unknown_as_hole: true,
raise_if_padding: false,
};

let editable = (~inline) => {
Expand All @@ -72,6 +74,7 @@ module Settings = {
hide_fixpoints: false,
show_filters: true,
show_unknown_as_hole: true,
raise_if_padding: false,
};
};
};
Expand Down Expand Up @@ -955,9 +958,12 @@ let mk_form =

/* HACK[Matt]: Sometimes terms that should have multiple ids won't because
evaluation only ever gives them one */
let pad_ids = (n: int, ids: list(Id.t)): list(Id.t) => {
let pad_ids = (~settings: Settings.t, n: int, ids: list(Id.t)): list(Id.t) => {
let len = List.length(ids);
if (len < n) {
if (settings.raise_if_padding) {
raise(Failure("Padding required but not enough ids provided."));
Comment on lines +972 to +976
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The raise_if_padding setting is added to detect when padding is needed, but the raised exception uses a generic Failure with a string message. Consider defining a specific exception type for padding failures to make error handling more explicit and type-safe.

Suggested change
let pad_ids = (~settings: Settings.t, n: int, ids: list(Id.t)): list(Id.t) => {
let len = List.length(ids);
if (len < n) {
if (settings.raise_if_padding) {
raise(Failure("Padding required but not enough ids provided."));
exception PaddingRequired(string);
let pad_ids = (~settings: Settings.t, n: int, ids: list(Id.t)): list(Id.t) => {
let len = List.length(ids);
if (len < n) {
if (settings.raise_if_padding) {
raise(PaddingRequired("Padding required but not enough ids provided."));

Copilot uses AI. Check for mistakes.
};
ids @ List.init(n - len, _ => Id.mk());
} else {
ListUtil.split_n(n, ids) |> fst;
Expand Down Expand Up @@ -1049,6 +1055,7 @@ let fold_fun_if = (condition, f_name: string, pieces, exp) =>
that the expression has no Closures or DynamicErrorHoles
*/
let rec exp_to_pretty = (~settings: Settings.t, exp: Exp.t): pretty => {
let pad_ids = pad_ids(~settings);
let go = (~inline=settings.inline) =>
exp_to_pretty(
~settings={
Expand Down Expand Up @@ -1588,6 +1595,7 @@ let rec exp_to_pretty = (~settings: Settings.t, exp: Exp.t): pretty => {
}
and pat_to_pretty = (~settings: Settings.t, pat: Pat.t): pretty => {
let go = pat_to_pretty(~settings: Settings.t);
let pad_ids = pad_ids(~settings);
let wrap = wrap_with_secondary(~secondary=settings.secondary);
/* Use settings-aware concatenation and form building */
let (@) = concat_segment(~secondary=settings.secondary);
Expand Down Expand Up @@ -1750,6 +1758,7 @@ and pat_to_pretty = (~settings: Settings.t, pat: Pat.t): pretty => {
}
and typ_to_pretty = (~settings: Settings.t, typ: Typ.t): pretty => {
let go = typ_to_pretty(~settings: Settings.t);
let pad_ids = pad_ids(~settings);
let wrap = wrap_with_secondary(~secondary=settings.secondary);
/* Use settings-aware concatenation and form building */
let (@) = concat_segment(~secondary=settings.secondary);
Expand Down Expand Up @@ -1985,6 +1994,7 @@ and typ_to_pretty = (~settings: Settings.t, typ: Typ.t): pretty => {
}
and tpat_to_pretty = (~settings: Settings.t, tpat: TPat.t): pretty => {
let wrap = wrap_with_secondary(~secondary=settings.secondary);
let pad_ids = pad_ids(~settings);
/* Use settings-aware concatenation and form building */
switch (tpat |> IdTagged.term_of) {
| Invalid(t) =>
Expand Down
38 changes: 38 additions & 0 deletions src/haz3lcore/pretty/PadIds.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
open Language;

/* Number of IDs required for ExpToSegment compatibility per type constructor */
let necessary_ids: Typ.t => int =
ty => {
switch (ty.term) {
| Prod([]) => 1 /* Empty product (unit-like) */
| Prod(tys) => List.length(tys) - 1 /* One ID per separator */
| Sum(tys) => List.length(tys) + 1 /* Constructors + prefix */
| _ => 1 /* Default for other type constructors */
Comment on lines +3 to +10
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "Number of IDs required for ExpToSegment compatibility per type constructor" but the calculation for Sum types is List.length(tys) + 1 which suggests one ID for each constructor plus one for the prefix. However, it's not clear from the comment what "prefix" means or why it needs an ID. Consider adding more detailed documentation explaining the ID allocation strategy for each constructor type.

Suggested change
/* Number of IDs required for ExpToSegment compatibility per type constructor */
let necessary_ids: Typ.t => int =
ty => {
switch (ty.term) {
| Prod([]) => 1 /* Empty product (unit-like) */
| Prod(tys) => List.length(tys) - 1 /* One ID per separator */
| Sum(tys) => List.length(tys) + 1 /* Constructors + prefix */
| _ => 1 /* Default for other type constructors */
/**
* Compute how many IDs are needed on a type so that ExpToSegment can reuse
* them instead of allocating fresh IDs while segmenting an expression.
*
* The number depends on the shape of the type constructor:
* - Prod([]):
* Empty product (unit-like). We treat the whole value as a single
* segment and allocate a single ID for it.
* - Prod(tys):
* Non-empty product. ExpToSegment represents products as a sequence of
* fields separated by "separators" (e.g. commas). Only separators are
* styled via IDs, so we need one ID per separator: length(tys) - 1.
* - Sum(tys):
* Sum / variant type. ExpToSegment assigns:
* - one ID per constructor branch, and
* - one additional ID for the *shared prefix* of the sum, i.e. the
* common discriminator / prefix segment that is rendered before any
* particular constructor (for example, the "tag" position or a
* leading bar or keyword that is shared across all branches).
* Hence we need length(tys) constructor IDs + 1 prefix ID.
* - _ (other constructors):
* For all other type constructors we conservatively require a single ID.
*/
let necessary_ids: Typ.t => int =
ty => {
switch (ty.term) {
| Prod([]) => 1 /* Empty product (unit-like): whole value gets one ID */
| Prod(tys) =>
List.length(tys) - 1 /* One ID per separator between product fields */
| Sum(tys) =>
List.length(tys) + 1
/* One ID per constructor branch + one shared prefix/discriminator ID */
| _ => 1 /* Default: a single ID for other type constructors */

Copilot uses AI. Check for mistakes.
};
};

/**
* Pads type IDs to ensure ExpToSegment uses them instead of creating new ones,
* preserving ID correspondence for styling. Test_PadIds property test that checks
* ExpToSegment compatibility and padding equivalence.
*/
let pad_typ_ids = (ty: Typ.t): Typ.t => {
Typ.map_term(
~f_typ=
(cont, ty) => {
let current_ids = ty.annotation.ids;
let needed_ids = necessary_ids(ty);
let ids =
current_ids
@ List.init(needed_ids - List.length(current_ids), _ => Id.mk());
Comment on lines +25 to +27
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calculation needed_ids - List.length(current_ids) could be negative if current_ids has more elements than needed_ids. While List.init would fail with a negative value, this should be handled more gracefully. Consider using max(0, needed_ids - List.length(current_ids)) to prevent potential issues.

Suggested change
let ids =
current_ids
@ List.init(needed_ids - List.length(current_ids), _ => Id.mk());
let missing_ids = max(0, needed_ids - List.length(current_ids));
let ids =
current_ids
@ List.init(missing_ids, _ => Id.mk());

Copilot uses AI. Check for mistakes.
cont({
...ty,
annotation: {
ids,
secondary: ty.annotation.secondary,
},
});
},
ty,
);
};
1 change: 1 addition & 0 deletions src/haz3lcore/projectors/ProjectorBase.re
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ module View = {
(
~single_line: bool=?,
~background: bool=?,
~is_dynamic: Id.t => bool=?,
~text_only: bool=?,
Sort.t,
list(syntax)
Expand Down
28 changes: 12 additions & 16 deletions src/haz3lcore/projectors/ProjectorCore.re
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,21 @@ module Kind = {
| Csv => "csv"
};

/* This must be updated and kept 1-to-1 with the above
* name function in order to be able to select the
* projector in the projector panel menu */
module StringMap = Map.Make(String);
let name_to_kind: StringMap.t(t) =
List.fold_left(
(map, kind) => StringMap.add(name(kind), kind, map),
StringMap.empty,
all,
);

let of_name = (p: string): t =>
switch (p) {
| "fold" => Fold
| "probe" => Probe
| "statics" => Statics
| "check" => Checkbox
| "slider" => Slider
| "sliderf" => SliderF
| "text" => TextArea
| "livelit" => Livelit
| "card" => Card
| "csv" => Csv
| _ => failwith("Unknown projector kind")
switch (StringMap.find_opt(p, name_to_kind)) {
| Some(k) => k
| None => failwith("Unknown projector kind")
};

let is_name = str => List.mem(str, List.map(name, all));
let is_name = StringMap.mem(_, name_to_kind);
};

/* Projectors in syntax */
Expand Down
20 changes: 8 additions & 12 deletions src/haz3lcore/projectors/ProjectorPerform.re
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,14 @@ let go =
if (ProjectorCore.Kind.is_refractor(kind)) {
Zipper.update_manuals(
map =>
ListUtil.assoc_update(
projector_idx_to_id(idx),
fun
| Some(entry: Refractors.entry) =>
Some(
Refractors.{
kind: entry.kind,
model: new_model,
},
)
| None => None,
map,
ListUtil.update_nth(idx, map, ((id, entry: Refractors.entry)) =>
(
id,
Refractors.{
kind: entry.kind,
model: new_model,
},
)
),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for #2097

z,
);
Expand Down
91 changes: 73 additions & 18 deletions src/haz3lcore/projectors/implementations/TypeProj.re
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,44 @@ let totalize_ty = (expected_ty: option(Typ.t)): Typ.t =>
| None => Typ.fresh(Unknown(Internal))
};

let get_dynamic_typ = (info: info): Typ.t => {
let dynamic_typ =
info.dynamics
|> Option.bind(
_,
(d: Dynamics.Info.t) => {
let statics =
Statics.mk(CoreSettings.on, Builtins.ctx_init(Some(Int)));
let type_of = (c: Sample.t) => {
IdTagged.rep_id(c.value)
|> Id.Map.find_opt(_, statics(c.value))
|> Option.bind(
_,
fun
| InfoExp(e) => {
Some(e.ty);
}
| _ => None,
);
};
let types = List.map(type_of, d.samples) |> Util.OptUtil.sequence;

Option.bind(
types,
Typ.meet_all(~empty=Typ.fresh(Unknown(Internal)), Ctx.empty),
);
},
)
|> Option.value(~default=Typ.fresh(Unknown(Internal)));
dynamic_typ;
};

module M: Projector = {
[@deriving (show({with_path: false}), sexp, yojson)]
type model =
| Expected
| Self;
| Self
| Dynamic;

[@deriving (show({with_path: false}), sexp, yojson)]
type action =
Expand All @@ -37,54 +70,76 @@ module M: Projector = {
let init = (any: Any.t): option(model) => {
switch (any) {
| Exp(_)
| Pat(_) => Some(Expected)
| Pat(_)
| Typ(_) => Some(Expected)
| Any () => Some(Expected) /* Grout don't have sorts rn */
| _ => None
};
};

let dynamics = false;
let dynamics = true;
let focusable = Focusable.non;

let display_ty = (model, statics): option(Typ.t) =>
switch (model) {
| _ when expected_ty(statics) |> totalize_ty |> Typ.is_syn =>
statics |> self_ty
| Self => statics |> self_ty
| Expected => statics |> expected_ty
};

let display_mode = (model: model, statics: option(Language.Info.t)): string =>
let display_mode = (model: model, statics: option(Language.Info.t)): string => {
switch (model) {
| Dynamic => "↦"
| _ when self_ty(statics) == expected_ty(statics) => "⇔"
| _ when expected_ty(statics) |> totalize_ty |> Typ.is_syn => "⇒"
| Self => "⇒"
| Expected => "⇐"
};

};
let mode_view = (model, info) =>
div(
~attrs=[Attr.classes(["mode"])],
[text(display_mode(model, info))],
);

let typ_view = (model, info: info, utility, view_seg: View.seg) => {
let typ = display_ty(model, info.statics) |> totalize_ty;
let (is_dynamic, typ) =
switch (model) {
| Dynamic =>
let dyn_typ =
get_dynamic_typ(info)
|> Grammar.map_typ_annotation(_ => IdTagged.IdTag.fresh())
|> PadIds.pad_typ_ids;
let self_ty =
Option.value(
~default=Typ.fresh(Unknown(Internal)),
self_ty(info.statics),
);
let dynamic_ids: list(Id.t) = Typ.diff(self_ty, dyn_typ);
(List.mem(_, dynamic_ids), dyn_typ);
| Expected when expected_ty(info.statics) |> totalize_ty |> Typ.is_syn => (
(_ => false),
self_ty(info.statics) |> totalize_ty,
)
| Expected => ((_ => false), expected_ty(info.statics) |> totalize_ty)
| Self => ((_ => false), self_ty(info.statics) |> totalize_ty)
};

div(
~attrs=[Attr.classes(["type-cell"])],
[
Typ(typ)
|> utility.term_to_seg
|> view_seg(~single_line=true, Sort.Typ),
|> view_seg(~single_line=true, ~is_dynamic, Sort.Typ),
],
);
};

let update = (model, _, a: action) =>
let update = (model, info, a: action) => {
let has_expected =
switch (expected_ty(info.statics)) {
| Some(ty) => !Typ.is_syn(ty)
| None => false
};
switch (a, model) {
| (ToggleDisplay, Expected) => Self
| (ToggleDisplay, Self) => Expected
| (ToggleDisplay, Expected) => if (has_expected) {Self} else {Dynamic}
| (ToggleDisplay, Self) => Dynamic
| (ToggleDisplay, Dynamic) => if (has_expected) {Expected} else {Self}
};
};

let placeholder = (_, _) => ProjectorCore.Shape.default;

Expand Down
1 change: 1 addition & 0 deletions src/haz3lcore/zipper/action/Introduce.re
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ module Make =
hide_fixpoints: false,
show_filters: true,
show_unknown_as_hole: true,
raise_if_padding: false,
},
term,
already_parenthesized(z),
Expand Down
12 changes: 2 additions & 10 deletions src/language/statics/Elaborator.re
Original file line number Diff line number Diff line change
Expand Up @@ -451,21 +451,13 @@ let rec elaborate = (m: Statics.Map.t, uexp: Exp.t): (DHExp.t, Typ.t) => {
);
Match(e', List.combine(ps', es')) |> rewrap;
};

(dhexp, elaborated_type);
};

//let dhexp_of_uexp = Core.Memo.general(~cache_size_bound=1000, dhexp_of_uexp);

/* This function gives a new id to all the types
in the expression. It does this to get rid of
all the invalid ids we added to prevent generating
too many new ids */
let fix_typ_ids =
Exp.map_term(~f_typ=(cont, e) => e |> IdTagged.new_ids |> cont);

let uexp_elab = (m: Statics.Map.t, uexp: Exp.t): ElaborationResult.t => {
switch (elaborate(m, uexp)) {
| exception MissingTypeInfo => DoesNotElaborate
| (d, ty) => Elaborates(d |> fix_typ_ids, ty)
| (d, ty) => Elaborates(d, ty)
};
};
2 changes: 2 additions & 0 deletions src/language/term/IdTagged.re
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ module IdTag = {
ids,
secondary,
};

let rep_id = ({ids, _}: t) => List.hd(ids);
};

[@deriving (show({with_path: false}), sexp, yojson)]
Expand Down
Loading
Loading