cc @Folkert de Vries @Richard Feldman
As discussed earlier today in the meeting, for collecting lambda sets that an app "fills in" for a host-exposed type,
HostExposedPolymorphic : Name => Annotation
HostExposedAppSpecialized : Name => Annotation
Name, PolymorphicAnnotation
in HostExposedPolymorphic
PolymorphicAnnotation
, create a mapping HELS: LSNum => Variable
where each variable (should be) the empty lambda setAppSpecializedAnnotation = HostExposedAppSpecialized[Name]
AppSpecializedAnnotation ~ PolymorphicAnnotation
LSNum, LSVar
in HELS
, look up the new content of LSVar
. This is the app-specialized lambda set for which a lambda set caller function should be generated for at the LSNum
lambda set number. for (symbol, variable, annotation) in it {
progress is being made
@Ayaz Hafiz running into a problem still
so, we're very close, but now the type of main misses the lambda set. This is the main
branch:
[crates/compiler/mono/src/ir.rs:8529] proc_name = `#UserApp.main`
[crates/compiler/mono/src/ir.rs:8531] SubsFmtContent(&content, env.subs) = Alias(`pf..IdentId(1)`, [67], <1556>Alias(`pf.Task.Task`, [1, 3, 67, 3], <1557>Opaque(`pf.Effect.Effect`, [1567, 1564], <1568>Func([<1578>EmptyRecord,], <1564=1576>LambdaSet([`pf.Effect.IdentId(15)` <1571>Func([<1578>EmptyRecord,], <1574=1579>LambdaSet([`pf.Effect.IdentId(33)` <80>Apply(`Str.Str`, []) , ], ^<1571>), <1578>EmptyRecord) <1572>Func([<1578>EmptyRecord,], <1573=1584>LambdaSet([`pf.Task.IdentId(62)` , ], ^<1572>), <1582>['Err' <1563>EmptyTagUnion , 'Ok' <1562>EmptyRecord , ]<Any(1570)>) , ], ^<1568>), <1586>Alias(`Result.Result`, [1562, 1563, 1565], <1567>['Err' <1563>EmptyTagUnion , 'Ok' <1562>EmptyRecord , ]<Any(1570)>)))))
[crates/compiler/mono/src/ir.rs:8532] layout_cache.interner.dbg(ret_layout) = "{}"
[crates/compiler/mono/src/ir.rs:8533] layout_cache.interner.dbg(lambda_set.full_layout) = "{Str, {}}"
and this is on our changed branch
[crates/compiler/mono/src/ir.rs:8595] proc_name = `#UserApp.main`
[crates/compiler/mono/src/ir.rs:8597] SubsFmtContent(&content, env.subs) = Alias(`pf..IdentId(1)`, [72], <1578>Alias(`pf.Task.Task`, [1, 3, 72, 3], <1579>Opaque(`pf.Effect.Effect`, [1580, 72], <1581>Func([<1587>EmptyRecord,], <72=1584>LambdaSet([], ^<1581>), <1586>Alias(`Result.Result`, [1, 3, 3], <1582>['Err' <3>EmptyTagUnion , 'Ok' <1>EmptyRecord , ]<Any(3)>)))))
[crates/compiler/mono/src/ir.rs:8598] layout_cache.interner.dbg(ret_layout) = "{}"
[crates/compiler/mono/src/ir.rs:8599] layout_cache.interner.dbg(lambda_set.full_layout) = "[]"
A theory is that we don't introduce (in constraint gen) the "freshened" lambda set variables. But I'm not sure what to do there, or how to debug this further
this is in trying to run an example that actually uses Task
, the CFold example from the benchmarks specifically
what is really weird about this is that our changes influence the type that is inferred for main, even though we don't actually do anything with it
ok nvm, needed to switch some constraints around
2 hours down the drain ...
https://github.com/roc-lang/roc/pull/5687
Did you manage to resolve it?
yes by switching the constraint solving order
the "real" annotation should go first and introduce all the variables
Last updated: Jul 06 2025 at 12:14 UTC