Skip to content

Commit ea10b26

Browse files
ageronlukewilliamboswell
authored andcommitted
Replace backpassing with ?
1 parent 9daf4f8 commit ea10b26

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

examples/getVisualWidth.roc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ app [main] {
44
}
55

66
import pf.Stdout
7+
import pf.Task exposing [Task]
78
import unicode.CodePoint
89

910
word = "世界"

examples/nrOfCodePoints.roc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ app [main] {
44
}
55

66
import pf.Stdout
7-
import pf.Task
7+
import pf.Task exposing [Task]
88
import unicode.CodePoint exposing [Utf8ParseErr]
99

1010
## Get the number of code points for a given Str

package/Grapheme.roc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@ split = \str ->
3030
# I'm not sure if we should return an error here or just crash.
3131
# A Roc Str should be be valid utf8 and so in theory it should not be possible
3232
# for split to have invalid utf8 in it. To be discussed.
33-
str
34-
|> Str.toUtf8
35-
|> CodePoint.parseUtf8
36-
|> Result.map \codePoints ->
33+
codePoints = str |> Str.toUtf8 |> CodePoint.parseUtf8?
3734

38-
breakPoints = codePoints |> List.map InternalGBP.fromCP
35+
breakPoints = codePoints |> List.map InternalGBP.fromCP
3936

40-
splitHelp Next codePoints breakPoints [BR GB1] |> toListStr
37+
Ok (splitHelp Next codePoints breakPoints [BR GB1] |> toListStr)
4138

4239
# Used internally to filter out the break/nobreak tokens and separate CPs into a List Str
4340
toListStr : Tokens -> List Str

0 commit comments

Comments
 (0)