diff --git a/crates/cli_testing_examples/benchmarks/platform/main.roc b/crates/cli_testing_examples/benchmarks/platform/main.roc index 0b86055696..e4802e2503 100644 --- a/crates/cli_testing_examples/benchmarks/platform/main.roc +++ b/crates/cli_testing_examples/benchmarks/platform/main.roc @@ -5,5 +5,5 @@ platform "benchmarks" imports [Task.{ Task }] provides [mainForHost] -mainForHost : Task {} [] as Fx +mainForHost : Task {} [] mainForHost = main diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index 284dd2d588..58884bbad6 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -3099,10 +3099,18 @@ fn specialize_host_specializations<'a>( let mut aliases = BumpMap::default(); - for (id, _, raw_function_layout) in hels { + for (var, id) in hels { let symbol = env.unique_symbol(); let lambda_name = LambdaName::no_niche(symbol); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena, env.target_info); + let lambda_set = env.subs.get_lambda_set(var); + let raw_function_layout = + RawFunctionLayout::from_var(&mut layout_env, lambda_set.ambient_function) + .value() + .unwrap(); + let (key, (top_level, proc)) = generate_host_exposed_function( env, procs, @@ -10004,7 +10012,7 @@ impl LambdaSetId { fn find_lambda_sets<'a>( env: &mut crate::layout::Env<'a, '_>, initial: Variable, -) -> Vec<'a, (LambdaSetId, Variable, RawFunctionLayout<'a>)> { +) -> MutMap { let mut stack = bumpalo::collections::Vec::new_in(env.arena); // ignore the lambda set of top-level functions @@ -10020,21 +10028,7 @@ fn find_lambda_sets<'a>( } } - let lambda_set_variables = find_lambda_sets_help(env.subs, stack); - let mut answer = - bumpalo::collections::Vec::with_capacity_in(lambda_set_variables.len(), env.arena); - - for (variable, lambda_set_id) in lambda_set_variables { - let lambda_set = env.subs.get_lambda_set(variable); - let raw_function_layout = RawFunctionLayout::from_var(env, lambda_set.ambient_function) - .value() - .unwrap(); - - let key = (lambda_set_id, variable, raw_function_layout); - answer.push(key); - } - - answer + find_lambda_sets_help(env.subs, stack) } pub fn find_lambda_sets_help( diff --git a/examples/cli/cli-platform/main.roc b/examples/cli/cli-platform/main.roc index 8e185a6db1..c8f90a9191 100644 --- a/examples/cli/cli-platform/main.roc +++ b/examples/cli/cli-platform/main.roc @@ -5,5 +5,5 @@ platform "cli" imports [Task.{ Task }] provides [mainForHost] -mainForHost : Task {} [] as Fx +mainForHost : Task {} [] mainForHost = main diff --git a/examples/cli/effects-platform/main.roc b/examples/cli/effects-platform/main.roc index 5e718ffc47..e2092147f7 100644 --- a/examples/cli/effects-platform/main.roc +++ b/examples/cli/effects-platform/main.roc @@ -5,5 +5,5 @@ platform "effects" imports [pf.Effect] provides [mainForHost] -mainForHost : Effect.Effect {} as Fx +mainForHost : Effect.Effect {} mainForHost = main diff --git a/examples/cli/false-interpreter/platform/main.roc b/examples/cli/false-interpreter/platform/main.roc index 2d737816a5..cf97352ce4 100644 --- a/examples/cli/false-interpreter/platform/main.roc +++ b/examples/cli/false-interpreter/platform/main.roc @@ -5,5 +5,5 @@ platform "false-interpreter" imports [Task.{ Task }] provides [mainForHost] -mainForHost : Str -> Task {} [] as Fx +mainForHost : Str -> Task {} [] mainForHost = \file -> main file