The Str module does not expose graphemes
:
21│ |> Str.graphemes
^^^^^^^^^^^^^
https://www.roc-lang.org/builtins/Str/#graphemes
the PR for that was merged today, so you may have a version of the compiler that does not support it yet
So I will wait for the next nightly build to be available, probably tomorrow, thanks.
Here's the previous conversation on this topic:
https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/.E2.9C.94.20Missing.20Str.2Egraphemes
I was a little anxious to finish this advent of code exercise (2015, 3rd), so I converted the String input myself.
https://pastebin.com/YGB2rkFP
In lieu of not having that function, I did the following for Roctoberfest:
parseContents : Str -> Result Report [ContentsParseErr Str]*
parseContents = \contents ->
line <- Str.split contents "\n" |> List.mapTry
err <- Result.mapErr (parseLine line)
when err is
InvalidBit -> ContentsParseErr "The line \"\(line)\" have an invalid bit"
parseLine : Str -> Result ReportLine [InvalidBit]*
parseLine = \line -> List.mapTry (Str.toUtf8 line) parseBit
expect parseLine "101010011010" == Ok [One, Zero, One, Zero, One, Zero, Zero, One, One, Zero, One, Zero]
parseBit : U8 -> Result Bit [InvalidBit]*
parseBit = \bit ->
when bit is
48 -> Ok Zero
49 -> Ok One
_ -> Err InvalidBit
@Gabriela the new nightlies are available now, except for MacOS x86_64, I'll look into what went wrong there.
New MacOS x86_64 nightlies are available now as well.
Last updated: Jul 06 2025 at 12:14 UTC