Re: filepath-1.4.100.0 released
Julian Ospald <[email protected]> Sat, 16 Jul 2022 08:03:22 +0000
| Newsgroups | gmane.comp.lang.haskell.libraries |
|---|---|
| Message-ID | <[email protected]> |
--===============6776382086317093492==
Content-Type: multipart/alternative;
boundary=----WWE4LTNLCCQMXOKQW5HUTZ3F7H1CJ9
Content-Transfer-Encoding: 7bit
------WWE4LTNLCCQMXOKQW5HUTZ3F7H1CJ9
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
Rust converts to an internal encoding that seems to be a common representat=
ion across platforms: WTF-8
https://simonsapin=2Egithub=2Eio/wtf-8/
That has some odd properties when getting length and trying to split strin=
gs=2E That lead to yet another experiment: OMG-WTF-8
https://github=2Ecom/kennytm/omgwtf8
I'm not sure this is a sensible path=2E I much prefer the "don't touch the=
bytes"=2E
Erlang on the other hand seems to try to decode as UTF-8 (or something els=
e you tell it to on startup) and falls back to "raw filenames" if decoding =
of a filepath fails:
* https://www=2Eerlang=2Eorg/doc/man/filename=2Ehtml
* https://www=2Eerlang=2Eorg/doc/apps/stdlib/unicode_usage=2Ehtml#notes-ab=
out-raw-filenames
This wouldn't be too hard to do in Haskell, as something like:
data OsPath =3D OsPath { filepath =3D Maybe String, rawFilepath =3D ShortB=
yteString }
But I believe this is questionable API for a low-level library=2E Librarie=
s building on top of 'filepath' can easily provide such an API=2E
I'm not sure if there's any language that does the same as AFPP=2E=20
On July 16, 2022 6:02:39 AM UTC, Magnus Therning <magnus@therning=2Eorg> w=
rote:
>
>Julian Ospald <hasufell@posteo=2Ede> writes:
>
>> Hi,
>>=20
>> this release implements support for the "abstract filepath proposal" (A=
FPP)=2E
>> There are no breaking changes in the existing API=2E
>>=20
>> Hackage: https://hackage=2Ehaskell=2Eorg/package/filepath-1=2E4=2E100=
=2E0
>>=20
>> More information can be found on my blog:
>> https://hasufell=2Egithub=2Eio/posts/2022-06-29-fixing-haskell-filepath=
s=2Ehtml
>
>This is very nice!
>
>The only other language mentioned is Python=2E Do you happen to have poin=
ters to how other languages handle this?
>
>/M
>
>--
>Magnus Therning OpenPGP: 0x927912051716CE39
>email: magnus@therning=2Eorg
>@magthe@mastodon=2Etechnology http://magnus=2Etherning=2Eorg/
>
>It is better to keep your mouth shut and appear stupid than to open it
>and remove all doubt=2E
> =E2=80=94 Mark Twain
------WWE4LTNLCCQMXOKQW5HUTZ3F7H1CJ9
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html><head></head><body>Rust converts to an internal encoding that seems t=
o be a common representation across platforms: WTF-8<br><br><a href=3D"http=
s://simonsapin=2Egithub=2Eio/wtf-8/">https://simonsapin=2Egithub=2Eio/wtf-8=
/</a><br><br>That has some odd properties when getting length and trying to=
split strings=2E That lead to yet another experiment: OMG-WTF-8<br><br><a =
href=3D"https://github=2Ecom/kennytm/omgwtf8">https://github=2Ecom/kennytm/=
omgwtf8</a><br><br>I'm not sure this is a sensible path=2E I much prefer th=
e "don't touch the bytes"=2E<br><br><br>Erlang on the other hand seems to t=
ry to decode as UTF-8 (or something else you tell it to on startup) and fal=
ls back to "raw filenames" if decoding of a filepath fails:<br><br>* <a hre=
f=3D"https://www=2Eerlang=2Eorg/doc/man/filename=2Ehtml">https://www=2Eerla=
ng=2Eorg/doc/man/filename=2Ehtml</a><br>* <a href=3D"https://www=2Eerlang=
=2Eorg/doc/apps/stdlib/unicode_usage=2Ehtml#notes-about-raw-filenames">http=
s://www=2Eerlang=2Eorg/doc/apps/stdlib/unicode_usage=2Ehtml#notes-about-raw=
-filenames</a><br><br>This wouldn't be too hard to do in Haskell, as someth=
ing like:<br><br>data OsPath =3D OsPath { filepath =3D Maybe String, rawFil=
epath =3D ShortByteString }<br><br>But I believe this is questionable API f=
or a low-level library=2E Libraries building on top of 'filepath' can easil=
y provide such an API=2E<br><br><br>I'm not sure if there's any language th=
at does the same as AFPP=2E <br><br><div class=3D"gmail_quote">On July 16, =
2022 6:02:39 AM UTC, Magnus Therning <magnus@therning=2Eorg> wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0=2E8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre dir=3D"auto" class=3D"k9mail"><br>Julian Ospald <hasufell@posteo=
=2Ede> writes:<br><br><blockquote class=3D"gmail_quote" style=3D"margin:=
0pt 0pt 1ex 0=2E8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">H=
i,<br><br>this release implements support for the "abstract filepath propos=
al" (AFPP)=2E<br>There are no breaking changes in the existing API=2E<br><b=
r>Hackage: <a href=3D"https://hackage=2Ehaskell=2Eorg/package/filepath-1=2E=
4=2E100=2E0">https://hackage=2Ehaskell=2Eorg/package/filepath-1=2E4=2E100=
=2E0</a><br><br>More information can be found on my blog:<br><a href=3D"htt=
ps://hasufell=2Egithub=2Eio/posts/2022-06-29-fixing-haskell-filepaths=2Ehtm=
l">https://hasufell=2Egithub=2Eio/posts/2022-06-29-fixing-haskell-filepaths=
=2Ehtml</a><br></blockquote><br>This is very nice!<br><br>The only other la=
nguage mentioned is Python=2E Do you happen to have pointers to how other l=
anguages handle this?<br><br>/M<br><br>--<br>Magnus Therning =
OpenPGP: 0x927912051716CE39<br>email: magnus@therning=2Eorg<br>@magthe@=
mastodon=2Etechnology <a href=3D"http://magnus=2Etherning=2Eorg/">htt=
p://magnus=2Etherning=2Eorg/</a><br><br>It is better to keep your mouth shu=
t and appear stupid than to open it<br>and remove all doubt=2E<br> =E2=
=80=94 Mark Twain<br></pre></blockquote></div></body></html>
------WWE4LTNLCCQMXOKQW5HUTZ3F7H1CJ9--
--===============6776382086317093492==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTGlicmFyaWVz
IG1haWxpbmcgbGlzdApMaWJyYXJpZXNAaGFza2VsbC5vcmcKaHR0cDovL21haWwuaGFza2VsbC5v
cmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL2xpYnJhcmllcwo=
--===============6776382086317093492==--