Comments.
parent
ca93e11fb4
commit
20ba8f9144
|
@ -49,10 +49,12 @@ utf8ToArrayBuffer s = Builder.execPutM do
|
||||||
toIPC :: String -> Effect ArrayBuffer
|
toIPC :: String -> Effect ArrayBuffer
|
||||||
toIPC = utf8ToArrayBuffer
|
toIPC = utf8ToArrayBuffer
|
||||||
|
|
||||||
-- TODO: this code shouldn't handle parse errors.
|
|
||||||
fromIPC :: ArrayBuffer -> Effect (Either ParseError String)
|
fromIPC :: ArrayBuffer -> Effect (Either ParseError String)
|
||||||
fromIPC = arrayBufferToUtf8
|
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 -> Effect (Either ParseError String)
|
||||||
arrayBufferToUtf8 arrayBuffer = do
|
arrayBufferToUtf8 arrayBuffer = do
|
||||||
textDecoder <- TextDecoder.new UtfLabel.utf8
|
textDecoder <- TextDecoder.new UtfLabel.utf8
|
||||||
|
|
Loading…
Reference in New Issue