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

module system #1020

Open
wants to merge 105 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
1135c5c
copy module from let
gensofubi May 17, 2023
46cbc73
a try on module
gensofubi May 19, 2023
27c2d02
minor changes
gensofubi May 19, 2023
1c66f50
keyword module done
gensofubi May 19, 2023
e07aed2
formatted
gensofubi May 19, 2023
9845316
concrete module typing (but no typeann yet) and dot access operator
gensofubi May 21, 2023
29a4ffe
change the expected def pattern in module to Tag
gensofubi May 24, 2023
b261e45
change dot form to fit submodule
gensofubi May 24, 2023
2bb2e3f
detailed typing information for modules and auto hole-insert fixed
gensofubi May 31, 2023
e8ca644
type annotation for module
gensofubi Jun 1, 2023
4aba625
fit for module with 1 or 0 members
gensofubi Jun 2, 2023
85fa3bd
unsuccessful trial on fixing a bug
gensofubi Jun 7, 2023
3d26edd
partially solve
gensofubi Jun 7, 2023
e1563a6
adjust behavior when module typeann is not consistent with member typ…
gensofubi Jun 7, 2023
0a727c2
adjust the behavior when member names are not consistent with module …
gensofubi Jun 7, 2023
9c8d63e
Merge branch 'adt-defs-after' into haz3l-module
gensofubi Jun 10, 2023
403eac5
again change the expected def pattern in module to Tag
gensofubi Jun 11, 2023
3620771
basic type members
gensofubi Jun 14, 2023
e97369c
add comments
gensofubi Jun 15, 2023
3f7db25
basic type alias in module's annotation
gensofubi Jun 16, 2023
b1c3b6d
change precedence for sum type alias in module annotation
gensofubi Jun 17, 2023
9377765
fix for Tags in module
gensofubi Jun 17, 2023
fc8a9d5
in analitic mode, use constructors without prefix
gensofubi Jun 17, 2023
0a11c6f
differ module type member with type variable with same name
gensofubi Jun 18, 2023
9bb1796
fix minor problems
gensofubi Jun 18, 2023
0f11919
adjust typing information display for module type members
gensofubi Jun 18, 2023
45b8c80
Providing warnings for using type members that are not defined, and i…
gensofubi Jun 21, 2023
c9cbf2a
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Jun 21, 2023
a6691dc
module langdoc copied from let
gensofubi Jun 28, 2023
09384db
module def langdoc
gensofubi Jun 29, 2023
477650a
Merge remote-tracking branch 'origin/adt-defs-after' into haz3l-module
gensofubi Jun 29, 2023
658e4f5
tyalias pat langdoc
gensofubi Jun 30, 2023
f097644
dot expression langdoc
gensofubi Jun 30, 2023
0f25baa
module type langdoc
gensofubi Jun 30, 2023
e247813
dot type langdoc
gensofubi Jul 1, 2023
449ac63
fit the problem on using member variable with member type
gensofubi Jul 2, 2023
a02f806
adjust type view: remove trailing comma, let the earlier definitions …
gensofubi Jul 2, 2023
9373f44
add tyalias for module having member type with same name
gensofubi Jul 2, 2023
d2034ba
change dot type to be a Typ postfix
gensofubi Jul 5, 2023
a57da2b
type view adjusted
gensofubi Jul 5, 2023
24f6748
Merge remote-tracking branch 'origin/adt-defs-after' into haz3l-module
gensofubi Jul 7, 2023
1513e98
fix exception when Applying Constructors defined in modules
gensofubi Jul 7, 2023
d8108d6
add comments in Statics.re and Module.re, remove unused function in C…
gensofubi Jul 10, 2023
14d5025
change error message for an invalid module name
gensofubi Jul 11, 2023
9285692
detailed member value in DHDoc_Exp
gensofubi Jul 12, 2023
c4c61b9
change dot to infix
gensofubi Jul 13, 2023
660d88b
Merge remote-tracking branch 'origin/adt-defs-after' into haz3l-module
gensofubi Jul 14, 2023
888ac62
rec type mem consistency
gensofubi Jul 14, 2023
1dc51e7
type member bug fix
gensofubi Jul 14, 2023
8aaa894
Merge remote-tracking branch 'origin/adt-defs-after' into haz3l-module
gensofubi Jul 31, 2023
483fc79
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Aug 7, 2023
cc51001
change the cursor inspector print
gensofubi Aug 15, 2023
09aae62
langdoc modify
gensofubi Aug 15, 2023
4efc2e6
fix about ctrs in ana mode
gensofubi Aug 16, 2023
5f76744
change cls for capitalized var standing for modules
gensofubi Aug 16, 2023
abfe6db
langdoc for module vars(exp,pat,typ)
gensofubi Aug 17, 2023
c148a98
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Aug 27, 2023
d23540d
Merge branch 'dev' into haz3l-module
gensofubi Aug 31, 2023
0c421f2
Merge branch 'dev' into haz3l-module
gensofubi Sep 10, 2023
b41f68c
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Sep 17, 2023
bf5b462
Merge branch 'dev' into haz3l-module
gensofubi Oct 14, 2023
d64aaed
fix double casting on dot accessing
gensofubi Nov 9, 2023
e5b514a
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Nov 27, 2023
024dabe
change ModuleVal type to ClosureEnvironment
gensofubi Dec 4, 2023
4a084be
fix modules annotated with typevars
gensofubi Dec 4, 2023
b92bc48
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Dec 24, 2023
11e3b27
basic module alias
gensofubi Jan 8, 2024
4da0991
fix curly bracket problem
gensofubi Jan 8, 2024
82c8f61
fix dot parsing problem
gensofubi Jan 8, 2024
b371fbc
Merge branch 'haz3l-module' into module-alias
gensofubi Jan 8, 2024
715b677
evaluator merged
gensofubi Feb 17, 2024
fe99078
merged without stepper for module
gensofubi Feb 23, 2024
d0ad37c
Merge branch 'dev' into haz3l-module
gensofubi Feb 23, 2024
70688dc
Module alias (#1156)
cyrus- Mar 1, 2024
ff1ad0b
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Mar 1, 2024
baca0d2
stepper partly done with a bug
gensofubi Mar 2, 2024
5684b0a
fix incorrect use of Mark
gensofubi Mar 2, 2024
3cd13bc
fix nested module bug
gensofubi Mar 2, 2024
bb29147
remove redundant evaluator for module
gensofubi Mar 4, 2024
78661a9
signature correction
gensofubi Mar 4, 2024
6b57f29
cursor inspector message correction
gensofubi Mar 4, 2024
f7bdc10
context inspector of projections updated
gensofubi Mar 4, 2024
946242b
fix documentation bugs
gensofubi Mar 18, 2024
c4a746c
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Mar 18, 2024
73ca90a
fix type inconsistency warning on module patterns
gensofubi Mar 20, 2024
314111c
fixing alignment and linebreak use in cell-result
gensofubi Mar 21, 2024
c3408cd
Do not show members not included in the signature
gensofubi Mar 21, 2024
1ae0263
fix invalid module exception
gensofubi Mar 22, 2024
e5ad167
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Mar 22, 2024
40c1aa7
modules documentation page
gensofubi Mar 22, 2024
2a243b4
module types and nested member types inspector correction
gensofubi Mar 31, 2024
9c95134
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Apr 4, 2024
61ae8bb
merge
gensofubi Apr 4, 2024
5c4b189
basic casting issues
gensofubi Apr 12, 2024
a9dd6e7
fix alignment
gensofubi Apr 12, 2024
5b00e37
bug fix
gensofubi Apr 14, 2024
0678bcf
add holes to undefined but declared members
gensofubi Apr 14, 2024
b77204f
final refine of modules with signatures
gensofubi Apr 14, 2024
c356d29
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi Apr 14, 2024
87320ca
Cast for modules with Unknown type
gensofubi Apr 19, 2024
9e42970
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi May 4, 2024
450701b
hole type casting fix
gensofubi May 4, 2024
5e567bf
incomplete module type created for dot analyzing
gensofubi May 20, 2024
42f59bb
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi May 20, 2024
67986f0
Merge remote-tracking branch 'origin/dev' into haz3l-module
gensofubi May 30, 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
24 changes: 24 additions & 0 deletions src/haz3lcore/dynamics/DH.re
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module rec DHExp: {
| BoundVar(Var.t)
| Sequence(t, t)
| Let(DHPat.t, t, t)
| Module(DHPat.t, t, t)
| Dot(t, t)
| FixF(Var.t, Typ.t, t)
| Fun(DHPat.t, Typ.t, t, option(Var.t))
| TypFun(Term.UTPat.t, t, option(Var.t))
Expand All @@ -44,6 +46,7 @@ module rec DHExp: {
| Cast(t, Typ.t, Typ.t)
| FailedCast(t, Typ.t, Typ.t)
| InvalidOperation(t, InvalidOperationError.t)
| ModuleVal(ClosureEnvironment.t, list(Var.t))
| IfThenElse(if_consistency, t, t, t) // use bool tag to track if branches are consistent
and case =
| Case(t, list(rule), int)
Expand Down Expand Up @@ -79,6 +82,8 @@ module rec DHExp: {
| BoundVar(Var.t)
| Sequence(t, t)
| Let(DHPat.t, t, t)
| Module(DHPat.t, t, t)
| Dot(t, t)
| FixF(Var.t, Typ.t, t)
| Fun(DHPat.t, Typ.t, t, option(Var.t))
| TypFun(Term.UTPat.t, t, option(Var.t))
Expand All @@ -105,6 +110,7 @@ module rec DHExp: {
| Cast(t, Typ.t, Typ.t)
| FailedCast(t, Typ.t, Typ.t)
| InvalidOperation(t, InvalidOperationError.t)
| ModuleVal(ClosureEnvironment.t, list(Var.t))
| IfThenElse(if_consistency, t, t, t)
and case =
| Case(t, list(rule), int)
Expand All @@ -121,6 +127,8 @@ module rec DHExp: {
| Sequence(_, _) => "Sequence"
| Filter(_, _) => "Filter"
| Let(_, _, _) => "Let"
| Module(_, _, _) => "Module"
| Dot(_, _) => "DotMember"
| FixF(_, _, _) => "FixF"
| Fun(_, _, _, _) => "Fun"
| TypFun(_) => "TypFun"
Expand Down Expand Up @@ -149,6 +157,7 @@ module rec DHExp: {
| Cast(_, _, _) => "Cast"
| FailedCast(_, _, _) => "FailedCast"
| InvalidOperation(_) => "InvalidOperation"
| ModuleVal(_) => "ModuleVal"
| IfThenElse(_, _, _, _) => "IfThenElse"
};

Expand Down Expand Up @@ -182,6 +191,8 @@ module rec DHExp: {
| Sequence(a, b) => Sequence(strip_casts(a), strip_casts(b))
| Filter(f, b) => Filter(DHFilter.strip_casts(f), strip_casts(b))
| Let(dp, b, c) => Let(dp, strip_casts(b), strip_casts(c))
| Module(dp, b, c) => Module(dp, strip_casts(b), strip_casts(c))
| Dot(a, b) => Dot(strip_casts(a), strip_casts(b))
| FixF(a, b, c) => FixF(a, b, strip_casts(c))
| Fun(a, b, c, d) => Fun(a, b, strip_casts(c), d)
| TypFun(a, b, c) => TypFun(a, strip_casts(b), c)
Expand Down Expand Up @@ -214,6 +225,7 @@ module rec DHExp: {
| FloatLit(_) as d
| StringLit(_) as d
| Constructor(_) as d
| ModuleVal(_) as d
| InvalidOperation(_) as d => d
| IfThenElse(consistent, c, d1, d2) =>
IfThenElse(
Expand Down Expand Up @@ -244,6 +256,10 @@ module rec DHExp: {
DHFilter.fast_equal(f1, f2) && fast_equal(d1, d2)
| (Let(dp1, d11, d21), Let(dp2, d12, d22)) =>
dp1 == dp2 && fast_equal(d11, d12) && fast_equal(d21, d22)
| (Module(dp1, d11, d21), Module(dp2, d12, d22)) =>
dp1 == dp2 && fast_equal(d11, d12) && fast_equal(d21, d22)
| (Dot(d11, d21), Dot(d12, d22)) =>
fast_equal(d11, d12) && fast_equal(d21, d22)
| (FixF(f1, ty1, d1), FixF(f2, ty2, d2)) =>
f1 == f2 && ty1 == ty2 && fast_equal(d1, d2)
| (Fun(dp1, ty1, d1, s1), Fun(dp2, ty2, d2, s2)) =>
Expand Down Expand Up @@ -280,6 +296,8 @@ module rec DHExp: {
fast_equal(d1, d2) && reason1 == reason2
| (ConsistentCase(case1), ConsistentCase(case2)) =>
fast_equal_case(case1, case2)
| (ModuleVal(mv1, names1), ModuleVal(mv2, names2)) =>
mv1 == mv2 && names1 == names2
| (IfThenElse(c1, d11, d12, d13), IfThenElse(c2, d21, d22, d23)) =>
c1 == c2
&& fast_equal(d11, d21)
Expand All @@ -290,6 +308,8 @@ module rec DHExp: {
| (Sequence(_), _)
| (Filter(_), _)
| (Let(_), _)
| (Module(_), _)
| (Dot(_), _)
| (FixF(_), _)
| (Fun(_), _)
| (TypFun(_), _)
Expand All @@ -310,6 +330,7 @@ module rec DHExp: {
| (Cast(_), _)
| (FailedCast(_), _)
| (InvalidOperation(_), _)
| (ModuleVal(_), _)
| (IfThenElse(_), _)
| (ConsistentCase(_), _) => false

Expand Down Expand Up @@ -383,6 +404,8 @@ module rec DHExp: {
| Closure(ce, t) => Closure(ce, re(t))
| Sequence(t1, t2) => Sequence(re(t1), re(t2))
| Let(dhpat, t1, t2) => Let(dhpat, re(t1), re(t2))
| Module(dhpat, t1, t2) => Module(dhpat, re(t1), re(t2))
| Dot(t1, t2) => Dot(re(t1), re(t2))
| Ap(t1, t2) => Ap(re(t1), re(t2))
| ApBuiltin(s, args) => ApBuiltin(s, re(args))
| BinBoolOp(op, t1, t2) => BinBoolOp(op, re(t1), re(t2))
Expand All @@ -409,6 +432,7 @@ module rec DHExp: {
| IntLit(_)
| FloatLit(_)
| StringLit(_)
| ModuleVal(_)
| FailedCast(_, _, _) => exp
};
}
Expand Down
60 changes: 60 additions & 0 deletions src/haz3lcore/dynamics/Elaborator.re
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ let cast = (ctx: Ctx.t, mode: Mode.t, self_ty: Typ.t, d: DHExp.t) =>
switch (ana_ty, self_ty) {
| (Unknown(prov), Rec(_, Sum(_)))
| (Unknown(prov), Sum(_)) => DHExp.cast(d, self_ty, Unknown(prov))
| (_, Module(_))
| (Module(_), _) => DHExp.cast(d, self_ty, ana_ty)
| _ => d
}
/* Forms with special ana rules but no particular typing requirements */
Expand All @@ -89,6 +91,8 @@ let cast = (ctx: Ctx.t, mode: Mode.t, self_ty: Typ.t, d: DHExp.t) =>
| IfThenElse(_)
| Sequence(_)
| Let(_)
| Module(_)
| Dot(_)
| FixF(_) => d
/* Hole-like forms: Don't cast */
| InvalidText(_)
Expand All @@ -103,6 +107,7 @@ let cast = (ctx: Ctx.t, mode: Mode.t, self_ty: Typ.t, d: DHExp.t) =>
| InvalidOperation(_) => d
/* Normal cases: wrap */
| BoundVar(_)
| ModuleVal(_)
| Ap(_)
| ApBuiltin(_)
| BuiltinFun(_)
Expand Down Expand Up @@ -294,6 +299,60 @@ let rec dhexp_of_uexp =
Let(dp, FixF(self_id, ty, substituted_def), dbody);
};
};
| Module(p, def, body) =>
let* dp = dhpat_of_upat(m, p);
let* ddef = dhexp_of_uexp(m, def);
let+ dbody = dhexp_of_uexp(m, body);
/* if get module type, apply alias(Let).*/
let is_alias =
switch (Id.Map.find_opt(Term.UExp.rep_id(def), m)) {
| Some(InfoExp({self, _})) =>
switch (self) {
| Common(Just(Module(_))) => true
| _ => false
}
| _ => false
};
let signiture =
switch (Id.Map.find_opt(Term.UPat.rep_id(p), m)) {
| Some(InfoPat({ty, _})) =>
switch (ty) {
| Module(c) => c.inner_ctx
| _ => []
}
| _ => []
};
let (closure, names) =
List.fold_left(
((closure, names): (ClosureEnvironment.t, list(Var.t))) =>
fun
| Ctx.VarEntry({name, id, _}) => (
Environment.extend(
closure |> ClosureEnvironment.map_of,
(name, EmptyHole(id, 0)),
)
|> ClosureEnvironment.wrap(
ClosureEnvironment.id_of(closure),
),
[name, ...names],
)
| Ctx.TVarEntry(_)
| Ctx.ConstructorEntry(_) => (closure, names),
(ClosureEnvironment.empty, []),
signiture,
);
let rec body_modulize: DHExp.t => DHExp.t = (
fun
| Let(dp, d1, d2) => Let(dp, d1, body_modulize(d2))
| Module(dp, d1, d2) => Module(dp, d1, body_modulize(d2))
| _ as d => is_alias ? d : ModuleVal(closure, names)
);
let ddef = ddef |> body_modulize;
DHExp.Module(dp, ddef, dbody);
| Dot(e_mod, e_mem) =>
let* e_mod = dhexp_of_uexp(m, e_mod);
let+ e_mem = dhexp_of_uexp(m, e_mem);
DHExp.Dot(e_mod, e_mem);
| Ap(fn, arg)
| Pipeline(arg, fn) =>
let* c_fn = dhexp_of_uexp(m, fn);
Expand Down Expand Up @@ -456,6 +515,7 @@ and dhpat_of_upat = (m: Statics.Map.t, upat: Term.UPat.t): option(DHPat.t) => {
| TypeAnn(p, _ty) =>
let* dp = dhpat_of_upat(m, p);
wrap(dp);
| TyAlias(_, _) => Some(DHPat.InvalidText(u, 0, ""))
};
| Some(InfoExp(_) | InfoTyp(_) | InfoTPat(_) | Secondary(_))
| None => None
Expand Down
21 changes: 21 additions & 0 deletions src/haz3lcore/dynamics/EvalCtx.re
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ type cls =
| Sequence2
| Let1
| Let2
| Module1
| Module2
| ModuleVal
| Dot1
| Dot2
| TypAp
| Ap1
| Ap2
Expand Down Expand Up @@ -57,6 +62,10 @@ type t =
| Sequence2(DHExp.t, t)
| Let1(DHPat.t, t, DHExp.t)
| Let2(DHPat.t, DHExp.t, t)
| Module1(DHPat.t, t, DHExp.t)
| Module2(DHPat.t, DHExp.t, t)
| Dot1(t, DHExp.t)
| Dot2(DHExp.t, t)
| Fun(DHPat.t, Typ.t, t, option(Var.t))
| FixF(Var.t, Typ.t, t)
| TypAp(t, Typ.t)
Expand Down Expand Up @@ -126,6 +135,10 @@ let rec fuzzy_mark =
| Sequence2(_)
| Let1(_)
| Let2(_)
| Module1(_)
| Module2(_)
| Dot1(_)
| Dot2(_)
| Fun(_)
| FixF(_)
| TypAp(_)
Expand Down Expand Up @@ -173,6 +186,10 @@ let rec unwrap = (ctx: t, sel: cls): option(t) => {
| (Sequence2, Sequence2(_, c))
| (Let1, Let1(_, c, _))
| (Let2, Let2(_, _, c))
| (Module1, Module1(_, c, _))
| (Module2, Module2(_, _, c))
| (Dot1, Dot1(c, _))
| (Dot2, Dot2(_, c))
| (Fun, Fun(_, _, c, _))
| (FixF, FixF(_, _, c))
| (TypAp, TypAp(c, _))
Expand Down Expand Up @@ -228,6 +245,10 @@ let rec unwrap = (ctx: t, sel: cls): option(t) => {
| (IfThenElse3, IfThenElse2(_))
| (Let1, Let2(_))
| (Let2, Let1(_))
| (Module1, Module2(_))
| (Module2, Module1(_))
| (Dot1, Dot2(_, _))
| (Dot2, Dot1(_, _))
| (BinBoolOp1, BinBoolOp2(_))
| (BinBoolOp2, BinBoolOp1(_))
| (BinIntOp1, BinIntOp2(_))
Expand Down
1 change: 1 addition & 0 deletions src/haz3lcore/dynamics/EvaluatorError.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type t =
| CastBVHoleGround(DHExp.t)
| InvalidBoxedTypFun(DHExp.t)
| InvalidBoxedFun(DHExp.t)
| InvalidBoxedModule(DHExp.t)
| InvalidBoxedBoolLit(DHExp.t)
| InvalidBoxedIntLit(DHExp.t)
| InvalidBoxedFloatLit(DHExp.t)
Expand Down
1 change: 1 addition & 0 deletions src/haz3lcore/dynamics/EvaluatorError.rei
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type t =
| CastBVHoleGround(DHExp.t)
| InvalidBoxedTypFun(DHExp.t)
| InvalidBoxedFun(DHExp.t)
| InvalidBoxedModule(DHExp.t)
| InvalidBoxedBoolLit(DHExp.t)
| InvalidBoxedIntLit(DHExp.t)
| InvalidBoxedFloatLit(DHExp.t)
Expand Down
26 changes: 26 additions & 0 deletions src/haz3lcore/dynamics/EvaluatorPost.re
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let rec pp_eval = (d: DHExp.t): m(DHExp.t) =>
| IntLit(_)
| FloatLit(_)
| StringLit(_)
| ModuleVal(_)
| Constructor(_) => d |> return

| Sequence(d1, d2) =>
Expand All @@ -62,6 +63,10 @@ let rec pp_eval = (d: DHExp.t): m(DHExp.t) =>
let* d2' = pp_eval(d2);
Ap(d1', d2') |> return;

| Dot(d1, d2) =>
let* d1' = pp_eval(d1);
let* d2' = pp_eval(d2);
Dot(d1', d2') |> return;
| TypAp(d1, ty) =>
let* d1' = pp_eval(d1);
TypAp(d1', ty) |> return;
Expand Down Expand Up @@ -153,6 +158,7 @@ let rec pp_eval = (d: DHExp.t): m(DHExp.t) =>
/* These expression forms should not exist outside closure in evaluated result */
| BoundVar(_)
| Let(_)
| Module(_)
| ConsistentCase(_)
| Fun(_)
| TypFun(_)
Expand Down Expand Up @@ -190,6 +196,12 @@ let rec pp_eval = (d: DHExp.t): m(DHExp.t) =>
let* d2 = pp_uneval(env, d2);
Let(dp, d1, d2) |> return;

| Module(dp, d1, d2) =>
/* d1 should already be evaluated, d2 is not */
let* d1 = pp_eval(d1);
let* d2 = pp_uneval(env, d2);
Let(dp, d1, d2) |> return;

| ConsistentCase(Case(scrut, rules, i)) =>
/* scrut should already be evaluated, rule bodies are not */
let* scrut =
Expand Down Expand Up @@ -278,6 +290,7 @@ and pp_uneval = (env: ClosureEnvironment.t, d: DHExp.t): m(DHExp.t) =>
| IntLit(_)
| FloatLit(_)
| StringLit(_)
| ModuleVal(_)
| Constructor(_) => d |> return

| Test(id, d1) =>
Expand All @@ -297,6 +310,16 @@ and pp_uneval = (env: ClosureEnvironment.t, d: DHExp.t): m(DHExp.t) =>
let* d2' = pp_uneval(env, d2);
Let(dp, d1', d2') |> return;

| Module(dp, d1, d2) =>
let* d1' = pp_uneval(env, d1);
let* d2' = pp_uneval(env, d2);
Module(dp, d1', d2') |> return;

| Dot(d1, d2) =>
let* d1' = pp_uneval(env, d1);
let* d2' = pp_uneval(env, d2);
Dot(d1', d2') |> return;

| FixF(f, ty, d1) =>
let* d1' = pp_uneval(env, d1);
FixF(f, ty, d1') |> return;
Expand Down Expand Up @@ -470,6 +493,7 @@ let rec track_children_of_hole =
| IntLit(_)
| FloatLit(_)
| StringLit(_)
| ModuleVal(_)
| BuiltinFun(_)
| BoundVar(_) => hii
| Test(_, d)
Expand All @@ -483,11 +507,13 @@ let rec track_children_of_hole =
| InvalidOperation(d, _) => track_children_of_hole(hii, parent, d)
| Sequence(d1, d2)
| Let(_, d1, d2)
| Module(_, d1, d2)
| Ap(d1, d2)
| BinBoolOp(_, d1, d2)
| BinIntOp(_, d1, d2)
| BinFloatOp(_, d1, d2)
| BinStringOp(_, d1, d2)
| Dot(d1, d2)
| Cons(d1, d2) =>
let hii = track_children_of_hole(hii, parent, d1);
track_children_of_hole(hii, parent, d2);
Expand Down
Loading
Loading