Comments (5)
Doing some investigating related to this...
It looks like fromCodePoint and codePointAt use the binary code point representation, which omits the "1101 1" leader bits.'
https://en.wikipedia.org/wiki/UTF-16#Examples
This means that to encode a complete string in a Uint16Array buffer, we're going to need to do the translation between that smaller binary space to the full 32 bits and then split them by byte pairs.
That is to say, we need to translate from this encoding:
"0001 0000 0100 0011 0111" 20 bits, to this encoding: "D801 DC37", 32 bits.
This is not a simple as a simple split and append however, as the first 10 bits may change during the translation. See the UTF-16 for better specifics.
from purescript-arraybuffer.
A little note to this, that way quickcheck reasons about strings, they are only generated in the first 65k form, so we don't have a truly comprehensive dataset without generating it for this.
from purescript-arraybuffer.
The polyfills can provide essentially most of the behaviour needed if extracting the relevant components.
To do this without risk of stack overflows and efficiently is likely going to involve mutation. If I get to writing it this weekend it will likely be implemented in JS I'm afraid, rather than via folds in purescript.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
from purescript-arraybuffer.
I think it might actually be possible to use the lazy approach and make use of purescript-encoding with the polyfill. I will do an experiment once my PR to the encoding lib goes through to update it to 0.12.
The user seems inactive so I may start maintaining a fork if necessary, given that no contact details exist for them.
from purescript-arraybuffer.
I think we can effectively close this, as #17 is probably the upper limit of what we're going to get unless we do a total re-implementation.
from purescript-arraybuffer.
Related Issues (20)
- 8 bit read/writes should not send an Endianness argument HOT 1
- why do Getter results live in Eff? HOT 4
- why does `fromArray` take an `Array Number` argument instead of `Array Int`? HOT 2
- `as_Array` is broken HOT 6
- Transient Purescript-Text-Encoding is overly burdensome. HOT 20
- purescript-quotient HOT 2
- export Typed.part' HOT 6
- typelevel dependency HOT 2
- transfer to purescript-contrib HOT 1
- Don't export Typed.part' HOT 1
- Polyfill is not defined when using `spago bundle-app` HOT 21
- publishing a breaking release as v12.0.0
- Sync issue labels with standard names
- ST instead of Effect? HOT 5
- fromUint8Array, toUint8Array HOT 1
- Reification
- Slice and subArray documentation reversed HOT 1
- BigInt64Array, BigUint64Array
- Mutability of types in Data.ArrayBuffer.ArrayBuffer HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purescript-arraybuffer.