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 _.
Since the instructions specify that the input strings will always be simple ASCII, the
BadUtf8
error can never really happen, so the annotation forencode
could just beStr -> Str
, but it's simpler for the user if the annotation isStr -> Result Str _
, this way they can just callStr.fromUtf8
without having to worry about it. Moreover, a very long string of digits could breakdecode
, so it's also simpler to use annotationStr -> Result Str _
.