From 421f8d9c5cf4478a02eae621ed2c2ba1ea360294 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 1 Dec 2023 20:39:39 -0500 Subject: [PATCH] Fix Str.walkUtf8 docs --- crates/compiler/builtins/roc/Str.roc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/compiler/builtins/roc/Str.roc b/crates/compiler/builtins/roc/Str.roc index 400ef1c4589..15ecf45f324 100644 --- a/crates/compiler/builtins/roc/Str.roc +++ b/crates/compiler/builtins/roc/Str.roc @@ -880,8 +880,11 @@ walkUtf8WithIndexHelp = \string, state, step, index, length -> ## state for each byte. ## ## ``` -## result = walkUtf8 "hello, world!" "" (\state, byte -> state ++ String.fromCodePoint byte) -## expect result == Ok "hello, world!" +## sumOfUtf8Bytes = +## Str.walkUtf8 "Hello, World!" 0 \total, byte -> +## total + byte +## +## expect sumOfUtf8Bytes == 105 ## ``` walkUtf8 : Str, state, (state, U8 -> state) -> state walkUtf8 = \str, initial, step ->