Comments.

This commit is contained in:
Philippe Pittoli 2023-05-20 00:36:17 +02:00
parent ca93e11fb4
commit 20ba8f9144

View File

@ -49,10 +49,12 @@ utf8ToArrayBuffer s = Builder.execPutM do
toIPC :: String -> Effect ArrayBuffer
toIPC = utf8ToArrayBuffer
-- TODO: this code shouldn't handle parse errors.
fromIPC :: ArrayBuffer -> Effect (Either ParseError String)
fromIPC = arrayBufferToUtf8
-- TODO: this code doesn't verify the actual length of the message.
-- An inconsistent length would be an error sign, message should be discarded
-- and the connection should be closed.
arrayBufferToUtf8 :: ArrayBuffer -> Effect (Either ParseError String)
arrayBufferToUtf8 arrayBuffer = do
textDecoder <- TextDecoder.new UtfLabel.utf8