diff --git a/compiler/build/src/program.rs b/compiler/build/src/program.rs index e97c015d09..ee0d990ce5 100644 --- a/compiler/build/src/program.rs +++ b/compiler/build/src/program.rs @@ -97,6 +97,10 @@ pub fn gen_from_mono_module( if name.starts_with("roc_builtins.dict") || name.starts_with("dict.RocDict") { function.add_attribute(AttributeLoc::Function, attr); } + + if name.starts_with("roc_builtins.list") || name.starts_with("list.RocList") { + function.add_attribute(AttributeLoc::Function, attr); + } } let builder = context.create_builder(); diff --git a/compiler/builtins/bitcode/src/list.zig b/compiler/builtins/bitcode/src/list.zig index e6d16b9785..8ea824fa31 100644 --- a/compiler/builtins/bitcode/src/list.zig +++ b/compiler/builtins/bitcode/src/list.zig @@ -153,7 +153,7 @@ pub fn listKeepIf(list: RocList, transform: Opaque, caller: Caller1, alignment: if (list.bytes) |source_ptr| { const size = list.len(); var i: usize = 0; - var output = list.makeUnique(std.heap.c_allocator, alignment, list.len() * element_width); + var output = RocList.allocate(std.heap.c_allocator, alignment, list.len(), list.len() * element_width); const target_ptr = output.bytes orelse unreachable; var kept: usize = 0; diff --git a/examples/benchmarks/AStar.roc b/examples/benchmarks/AStar.roc index 4dbed14fe3..78f0022bf5 100644 --- a/examples/benchmarks/AStar.roc +++ b/examples/benchmarks/AStar.roc @@ -21,23 +21,11 @@ initialModel = \start -> } -filterMap : List a, (a -> Result b *) -> List b -filterMap = \list, toResult -> - List.walk list (\element, accum -> - when toResult element is - Ok value -> - List.append accum value - - Err _ -> - accum - ) - [] - cheapestOpen : (position -> F64), Model position -> Result position {} cheapestOpen = \costFn, model -> model.openSet |> Set.toList - |> filterMap (\position -> + |> List.keepOks (\position -> when Dict.get model.costs position is Err _ -> Err {}