exercism / roc

Exercism exercises in Roc.
https://exercism.org/tracks/roc
MIT License
10 stars 7 forks source link

Add run-length-encoding exercise #146

Closed ageron closed 1 month ago

ageron commented 1 month ago

Since the instructions specify that the input strings will always be simple ASCII, the BadUtf8 error can never really happen, so the annotation for encode could just be Str -> Str, but it's simpler for the user if the annotation is Str -> Result Str _, this way they can just call Str.fromUtf8 without having to worry about it. Moreover, a very long string of digits could break decode, so it's also simpler to use annotation Str -> Result Str _.