`fromCharCode` should return `Nothing` if the code is out of the Basic Multilingual Plane `Char` range, right? https://github.com/purescript/purescript-strings/blob/157e372a23e4becd594d7e7bff6f372a6f63dd82/src/Data/Char.purs#L16 ``` >>> show $ fromCharCode 65900 (Just 'Ŭ') ``` The [`Bounded` instance for `Char`](https://pursuit.purescript.org/packages/purescript-prelude/5.0.1/docs/Data.Bounded) says that “Characters fall within the Unicode range,” but the [`Char`](https://pursuit.purescript.org/builtins/docs/Prim#t:Char) says “guaranteed to contain one code unit.”
Activity
MonoidMusician commentedon Sep 22, 2021
Oh interesting, it appears this is actually the line at fault:
https://github.com/purescript/purescript-enums/blob/170d959644eb99e0025f4ab2e38f5f132fd85fa4/src/Data/Enum.purs#L316-L318
It's using
topandbottomfor ints, not chars. I guessn >= toCharCode bottom && n <= toCharCode topmight work?String.fromCharCodejust does(code) % 0x10000on the code, so what you're seeing is65900 % 0x10000 = 0x16C.JordanMartinez commentedon Sep 28, 2021
I've opened an issue in
purescript-enumto track this. Should this issue be closed?thomashoneyman commentedon Oct 5, 2021
I think it’s reasonable it stays open until the upstream issue is addressed
JordanMartinez commentedon Aug 15, 2022
Technically, we still need a release of that library and then a dependency update here.
JordanMartinez commentedon Aug 16, 2022
PR ready for approval: #163.