Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge DHExp and UExp #1197

Open
wants to merge 113 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
d90db51
Begin making DHExp look like UExp
Negabinary Jan 26, 2024
272d3a5
Make matches consistent across dhexp, uexp
Negabinary Jan 30, 2024
5389bdd
Add d_loc' and make step data structure more consistent
Negabinary Jan 25, 2024
9953921
Add ids to DHExp
Negabinary Feb 1, 2024
e3328e5
Switch to id-based stepper
Negabinary Feb 1, 2024
720ae55
Update comments from meeting with Andrew
Negabinary Feb 6, 2024
7dd9a78
Fix up ids to make them unique after evaluation
Negabinary Feb 6, 2024
bdf0310
Remove hole instance identifiers, postprocessing
Negabinary Feb 8, 2024
34204aa
Change how IDs are copied
Negabinary Feb 9, 2024
d74d432
Move compose function
Negabinary Feb 9, 2024
84287cd
Combine forward and reverse application
Negabinary Feb 10, 2024
76859cd
Merge branch 'dev' into remove-dhexp
Negabinary Feb 20, 2024
252bce2
Merge fixes
Negabinary Feb 20, 2024
4e98c22
Change how ids are renamed
Negabinary Feb 20, 2024
f53fede
Remove ExpandingKeyword from dhexp
Negabinary Feb 20, 2024
a6be94f
thread info_map through dynamics
Negabinary Feb 22, 2024
f55f55a
Add patterns to FixF DHExp, remove projection
Negabinary Feb 23, 2024
5127854
Surface fix
Negabinary Feb 23, 2024
f75a1d5
Remove Triv
Negabinary Feb 23, 2024
b3639ef
Rename InvalidText to Invalid
Negabinary Feb 23, 2024
19cd211
Add MultiHole to DHexp
Negabinary Feb 23, 2024
841207b
Remove set_info_map
Negabinary Feb 26, 2024
f5feb7a
DHPat renamings
Negabinary Feb 26, 2024
31482d6
Remove Triv
Negabinary Feb 26, 2024
741f133
Rename NonEmptyHole to StaticErrorHole, and use it more sparingly
Negabinary Feb 27, 2024
fc667f7
Rearranging DHExp
Negabinary Feb 27, 2024
6d73811
Add TyAlias
Negabinary Feb 27, 2024
92c1f63
Add Unary Operator to DHExp
Negabinary Feb 28, 2024
82f5c2c
Remove BuiltinAp
Negabinary Feb 28, 2024
7e47213
Add BuiltinFun to UExp
Negabinary Feb 28, 2024
16d2001
begone DHPat.t
Negabinary Feb 29, 2024
6d32831
Update comments
Negabinary Feb 29, 2024
460a81a
Add dynamic error hole forms to UExp (Hopefully they will be replaced…
Negabinary Feb 29, 2024
f9facd4
Remove id field from test
Negabinary Feb 29, 2024
22541ae
Add parens to DHExp.t
Negabinary Feb 29, 2024
16e8193
Write down which expressions are produced during evaluation
Negabinary Feb 29, 2024
62f4f0b
Remove type annotations from fun and fix (can be found in infomap if …
Negabinary Feb 29, 2024
1cf3527
Add copied field to UExp
Negabinary Feb 29, 2024
cf8f0ca
Add closures to UExp
Negabinary Feb 29, 2024
70101c9
Add casts to UExp
Negabinary Feb 29, 2024
11eee6b
Remove type from ListLit
Negabinary Mar 1, 2024
2e6f73e
(messily) finally merge DHExp and UExp
Negabinary Mar 1, 2024
e3012a8
Split Term into multiple files
Negabinary Mar 1, 2024
8fcd42c
Rename DHExp to DExp
Negabinary Mar 1, 2024
212ac71
Merge branch 'dev' into remove-dhexp
Negabinary Mar 4, 2024
7c00c38
Add a big map for terms
Negabinary Mar 5, 2024
4474937
Tidy up elaboration
Negabinary Mar 5, 2024
3900782
Use map for replacing ids
Negabinary Mar 7, 2024
6ffc082
Remove DHExp, DHPat
Negabinary Mar 7, 2024
c7637d6
Delete unused files
Negabinary Mar 7, 2024
69d5dba
Fix hidden steps always showing
Negabinary Mar 7, 2024
424c7c0
Move some functions, add some comments
Negabinary Mar 7, 2024
8ec663c
Revert DPat and DExp
Negabinary Mar 7, 2024
dc8719f
Move UTerms back
Negabinary Mar 7, 2024
d0d8c10
Update comments
Negabinary Mar 8, 2024
46c7caf
Add rec to UTyp (by copying from poly-adt-after2)
Negabinary Mar 19, 2024
1cfdd94
Begin Typ UTyp merge
Negabinary Mar 19, 2024
af061ee
Add comments
Negabinary Mar 21, 2024
63c7d9c
Remove Constructor from type
Negabinary Mar 25, 2024
ab74302
Add parens to Typ
Negabinary Mar 25, 2024
6a6fa38
Add ids to Typ
Negabinary Mar 27, 2024
98cf0e1
Factor out Ids
Negabinary Mar 28, 2024
ba44262
Fix #1150 for constructors
Negabinary Mar 29, 2024
4a4b7c2
Update UTyp sums to match Typ
Negabinary Apr 2, 2024
09cd50c
Merge Typ and UTyp
Negabinary Apr 2, 2024
f6dcb7a
Move type functions into one file
Negabinary Apr 2, 2024
687a429
Delete some small files
Negabinary Apr 2, 2024
7be9f32
Rewrite pattern matching
Negabinary Apr 3, 2024
d87a27a
Rewrite pattern matching
Negabinary Apr 3, 2024
cfd643c
Merge branch 'remove-dhexp' of https://github.com/hazelgrove/hazel in…
Negabinary Apr 4, 2024
3442532
Merge branch 'dev' into remove-dhexp
Negabinary Apr 9, 2024
e09c74c
Merge fixup
Negabinary Apr 9, 2024
8478fca
Take SynSwitches out of Elaboration
Negabinary Apr 10, 2024
4c8dd5a
Fix type parentheses problem
Negabinary Apr 10, 2024
c8c69b5
Make elaborator more explicit
Negabinary Apr 17, 2024
ee802a4
Remove infomap from transition
Negabinary Apr 17, 2024
caa04d8
Remove infomap from more places
Negabinary Apr 18, 2024
ba6dba5
Get infomap out of webworker
Negabinary Apr 18, 2024
99b56f4
Fix implicit fixpoint cast elaboration
Negabinary Apr 18, 2024
b2a74aa
Fix cast elaboration bugs
Negabinary Apr 19, 2024
07b0041
Merge branch 'dev' into remove-dhexp
Negabinary Apr 19, 2024
8871cd4
Merge fixup
Negabinary Apr 22, 2024
78ac980
statics + elab performance
Negabinary Apr 24, 2024
24ca95c
Remove attempt at type annotation
Negabinary Apr 24, 2024
882301a
Make pattern cast printing nicer
Negabinary Apr 24, 2024
4fe9d9c
Fix fixpoint elaboration
Negabinary Apr 29, 2024
d62f220
Get tests working
Negabinary May 2, 2024
35cf7b9
Fix constructor casting issues
Negabinary May 2, 2024
b38f781
Fix TypFun casting
Negabinary May 2, 2024
e93ec47
Fixpoint printing
Negabinary May 2, 2024
f42c61d
Fix history toggle
Negabinary May 2, 2024
79c9b6a
Merge branch 'dev' into remove-dhexp
Negabinary May 2, 2024
14e8446
Fix duplicate ids
Negabinary May 2, 2024
91c11ae
Update DHExp comment
Negabinary May 7, 2024
5e61682
Address the easiest of Andrew's comments
Negabinary May 7, 2024
d3bb38e
Address the easiest of Andrew's comments
Negabinary May 7, 2024
35c8729
Merge branch 'remove-dhexp' of https://github.com/hazelgrove/hazel in…
Negabinary May 8, 2024
a956b0d
Typ.mk_fast -> Typ.temp
Negabinary May 9, 2024
fd0c583
Remove to_typ
Negabinary May 9, 2024
a5dda32
Explain map_term
Negabinary May 9, 2024
860a015
Remove some more comments
Negabinary May 9, 2024
89a506c
Fix divide by zero bug
Negabinary May 10, 2024
d35375d
Fixed match types not working through parentheses
Negabinary May 16, 2024
25090f1
Fix constructor elaboration
Negabinary May 16, 2024
16e0ad2
Move test check marks back
Negabinary May 16, 2024
9c2bd7a
Fix sum cast accumulation
Negabinary May 20, 2024
8447c01
Fix builtins throwing errors
Negabinary May 28, 2024
5d77a82
Merge branch 'dev' into remove-dhexp
Negabinary May 28, 2024
91d135d
Merge branch 'dev' into remove-dhexp
Negabinary May 28, 2024
098f032
delete TypeAssignment.re
Negabinary Jun 7, 2024
d0d288c
Merge branch 'dev' into remove-dhexp
Negabinary Jun 7, 2024
8a183c7
Fix tests
Negabinary Jun 13, 2024
436559f
Fix named typfun showing up as anonymous
Negabinary Jun 14, 2024
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
4 changes: 2 additions & 2 deletions src/haz3lcore/TermMap.re
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include Id.Map;
type t = Id.Map.t(Term.t);
type t = Id.Map.t(Any.t);

let add_all = (ids: list(Id.t), tm: Term.t, map: t) =>
let add_all = (ids: list(Id.t), tm: Any.t, map: t) =>
ids |> List.fold_left((map, id) => add(id, tm, map), map);
1 change: 1 addition & 0 deletions src/haz3lcore/Unicode.re
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let zwsp = "​";

let typeArrowSym = "→"; // U+2192 "Rightwards Arrow"
let castArrowSym = "⇨";
let castBackArrowSym = "⇦";

let ellipsis = "\xE2\x80\xA6";

Expand Down
24 changes: 14 additions & 10 deletions src/haz3lcore/assistant/AssistantCtx.re
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let bound_constructors =
let bound_aps = (ty_expect: Typ.t, ctx: Ctx.t): list(Suggestion.t) =>
List.filter_map(
fun
| Ctx.VarEntry({typ: Arrow(_, ty_out) as ty_arr, name, _})
| Ctx.VarEntry({typ: {term: Arrow(_, ty_out), _} as ty_arr, name, _})
when
Typ.is_consistent(ctx, ty_expect, ty_out)
&& !Typ.is_consistent(ctx, ty_expect, ty_arr) => {
Expand All @@ -66,7 +66,11 @@ let bound_aps = (ty_expect: Typ.t, ctx: Ctx.t): list(Suggestion.t) =>
let bound_constructor_aps = (wrap, ty: Typ.t, ctx: Ctx.t): list(Suggestion.t) =>
List.filter_map(
fun
| Ctx.ConstructorEntry({typ: Arrow(_, ty_out) as ty_arr, name, _})
| Ctx.ConstructorEntry({
typ: {term: Arrow(_, ty_out), _} as ty_arr,
name,
_,
})
when
Typ.is_consistent(ctx, ty, ty_out)
&& !Typ.is_consistent(ctx, ty, ty_arr) =>
Expand Down Expand Up @@ -141,7 +145,7 @@ let suggest_lookahead_variable = (ci: Info.t): list(Suggestion.t) => {
let exp_aps = ty =>
bound_aps(ty, ctx)
@ bound_constructor_aps(x => Exp(Common(x)), ty, ctx);
switch (Mode.ty_of(mode)) {
switch (Mode.ty_of(mode) |> Typ.term_of) {
| List(ty) =>
List.map(restrategize(" )::"), exp_aps(ty))
@ List.map(restrategize("::"), exp_refs(ty))
Expand All @@ -152,20 +156,20 @@ let suggest_lookahead_variable = (ci: Info.t): list(Suggestion.t) => {
@ List.map(restrategize(commas), exp_refs(ty));
| Bool =>
/* TODO: Find a UI to make these less confusing */
exp_refs(Int)
@ exp_refs(Float)
@ exp_refs(String)
@ exp_aps(Int)
@ exp_aps(Float)
@ exp_aps(String)
exp_refs(Int |> Typ.fresh)
@ exp_refs(Float |> Typ.fresh)
@ exp_refs(String |> Typ.fresh)
@ exp_aps(Int |> Typ.fresh)
@ exp_aps(Float |> Typ.fresh)
@ exp_aps(String |> Typ.fresh)
| _ => []
};
| InfoPat({mode, co_ctx, _}) =>
let pat_refs = ty =>
free_variables(ty, ctx, co_ctx)
@ bound_constructors(x => Pat(Common(x)), ty, ctx);
let pat_aps = ty => bound_constructor_aps(x => Pat(Common(x)), ty, ctx);
switch (Mode.ty_of(mode)) {
switch (Mode.ty_of(mode) |> Typ.term_of) {
| List(ty) =>
List.map(restrategize(" )::"), pat_aps(ty))
@ List.map(restrategize("::"), pat_refs(ty))
Expand Down
30 changes: 18 additions & 12 deletions src/haz3lcore/assistant/AssistantForms.re
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,36 @@ let leading_expander = " " ++ AssistantExpander.c;
* running Statics, but for now, new forms e.g. operators must be added
* below manually. */
module Typ = {
let unk: Typ.t = Unknown(Internal);
let unk: Typ.t = Unknown(Internal) |> Typ.fresh;

let of_const_mono_delim: list((Token.t, Typ.t)) = [
("true", Bool),
("false", Bool),
("true", Bool |> Typ.fresh),
("false", Bool |> Typ.fresh),
//("[]", List(unk)), / *NOTE: would need to refactor buffer for this to show up */
//("()", Prod([])), /* NOTE: would need to refactor buffer for this to show up */
("\"\"", String), /* NOTE: Irrelevent as second quote appears automatically */
("\"\"", String |> Typ.fresh), /* NOTE: Irrelevent as second quote appears automatically */
("_", unk),
];

let of_leading_delim: list((Token.t, Typ.t)) = [
("case" ++ leading_expander, unk),
("fun" ++ leading_expander, Arrow(unk, unk)),
("typfun" ++ leading_expander, Forall("", unk)),
("fun" ++ leading_expander, Arrow(unk, unk) |> Typ.fresh),
(
"typfun" ++ leading_expander,
Forall(Var("") |> TPat.fresh, unk) |> Typ.fresh,
),
("if" ++ leading_expander, unk),
("let" ++ leading_expander, unk),
("test" ++ leading_expander, Prod([])),
("test" ++ leading_expander, Prod([]) |> Typ.fresh),
("type" ++ leading_expander, unk),
];

let of_infix_delim: list((Token.t, Typ.t)) = [
("|>", unk), /* */
let of_infix_delim: list((Token.t, Typ.term)) = [
("|>", Unknown(Internal)), /* */
(",", Prod([unk, unk])), /* NOTE: Current approach doesn't work for this, but irrelevant as 1-char */
("::", List(unk)),
("@", List(unk)),
(";", unk),
(";", Unknown(Internal)),
("&&", Bool),
("\\/", Bool),
("||", Bool),
Expand Down Expand Up @@ -72,7 +75,7 @@ module Typ = {
fun
| InfoExp({mode, _})
| InfoPat({mode, _}) => Mode.ty_of(mode)
| _ => Unknown(Internal);
| _ => Unknown(Internal) |> Typ.fresh;

let filter_by =
(
Expand Down Expand Up @@ -194,7 +197,10 @@ let suggest_form = (ty_map, delims_of_sort, ci: Info.t): list(Suggestion.t) => {
};

let suggest_operator: Info.t => list(Suggestion.t) =
suggest_form(Typ.of_infix_delim, Delims.infix);
suggest_form(
List.map(((a, b)) => (a, IdTagged.fresh(b)), Typ.of_infix_delim),
Delims.infix,
);

let suggest_operand: Info.t => list(Suggestion.t) =
suggest_form(Typ.of_const_mono_delim, Delims.const_mono);
Expand Down
Loading
Loading