roc-lang / basic-webserver

A basic webserver in Roc
https://roc-lang.github.io/basic-webserver/
Universal Permissive License v1.0
72 stars 15 forks source link

Update Url.roc to not use Str.appendScalar #22

Closed RMailaender closed 8 months ago

RMailaender commented 8 months ago

PR #6395 removed Str.appendScalar from builtins. The code should be updated to user roc-lang/unicode instead.

Anton-4 commented 8 months ago

roc-lang/unicode does not have this function implemented yet. I'll write up a pure Roc solution for now.

bhansconnect commented 8 months ago

I think we should just remove the need for Str.appendScalar instead of implementing it a different way.

Change percentEncode to accumulate to a List U8. Then do a single Str.fromUtf8 that crashes on failure to parse (cause that should be impossible).

bhansconnect commented 8 months ago

Yeah, we should copy this from basic-cli but crash instead of using withDefault: https://github.com/roc-lang/basic-cli/commit/6208966e479f44457800ce593de8a38140078b1b#diff-f2522523f2f51a7e343e40fc784e44fecce8bb276db26027f3353c63f475807bR197-R228