diff --git a/crates/compiler/builtins/roc/List.roc b/crates/compiler/builtins/roc/List.roc index 123c40093f..1626e617af 100644 --- a/crates/compiler/builtins/roc/List.roc +++ b/crates/compiler/builtins/roc/List.roc @@ -820,7 +820,11 @@ findIndex = \list, matcher -> ## Some languages have a function called **`slice`** which works similarly to this. sublist : List elem, { start : Nat, len : Nat } -> List elem sublist = \list, config -> - sublistLowlevel list config.start config.len + if config.len == 0 then + [] + else + sublistLowlevel list config.start config.len + sublistLowlevel : List elem, Nat, Nat -> List elem