mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Fix Parser example
This commit is contained in:
parent
88ea8ffb67
commit
fb82c09ac2
2 changed files with 6 additions and 4 deletions
|
@ -35,8 +35,9 @@ strToRaw = \str ->
|
|||
|
||||
strFromAscii : U8 -> Str
|
||||
strFromAscii = \asciiNum ->
|
||||
Str.fromUtf8 [asciiNum]
|
||||
|> Result.onErr \_ -> crash "The number $(asciiNum) is not a valid ASCII constant!"
|
||||
when Str.fromUtf8 [asciiNum] is
|
||||
Ok answer -> answer
|
||||
Err _ -> crash "The number $(Num.toStr asciiNum) is not a valid ASCII constant!"
|
||||
|
||||
strFromCodeunit : U8 -> Str
|
||||
strFromCodeunit = \cu ->
|
||||
|
|
|
@ -45,8 +45,9 @@ strToRaw = \str ->
|
|||
|
||||
strFromAscii : U8 -> Str
|
||||
strFromAscii = \asciiNum ->
|
||||
Str.fromUtf8 [asciiNum]
|
||||
|> Result.onErr \_ -> crash "The number $(asciiNum) is not a valid ASCII constant!"
|
||||
when Str.fromUtf8 [asciiNum] is
|
||||
Ok answer -> answer
|
||||
Err _ -> crash "The number $(Num.toStr asciiNum) is not a valid ASCII constant!"
|
||||
|
||||
strFromCodeunit : U8 -> Str
|
||||
strFromCodeunit = \cu ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue