Open safareli opened 5 years ago
it was introduced here https://github.com/rightfold/purescript-bytestrings/commit/532c8d369fc2c483171edee66140c1b15e3b77af#diff-f27773669f759a4a90a0d747ce24836bR224
probably Buffer.fromString is not throwing any more?
looks like Buffer.from
is not throwing:
➜ node -v
v8.12.0
➜ node
> Buffer.from("LOL", "utf8")
<Buffer 4c 4f 4c>
> Buffer.from("LOL", "hex")
<Buffer >
> Buffer.from("LOL#$%^&*(", "hex")
<Buffer >
> Buffer.byteLength("LOL#$%^&*(", "hex")
5
> Buffer.from("éééé", "ascii")
<Buffer e9 e9 e9 e9>
> Buffer.from("éééé", "ascii").toString()
'����'
> Buffer.from("éééé", "ascii").toString("ascii")
'iiii'
> Buffer.from("éééé", "ascii").toString("utf8")
'����'
> Buffer.byteLength("0x8", "hex")
1
> Buffer.from("0x8", "hex")
<Buffer >
> Buffer.from("qqq0x8123132", "hex")
<Buffer >
> Buffer.from("110x8123132", "hex")
<Buffer 11>
> Buffer.from("1_-10x8123132", "hex")
<Buffer >
and i'm not able to reproduce https://github.com/purescript-node/purescript-node-buffer/issues/23
so it seems we should remove Maybe wrapping
There was test
quickCheck $ fromString "LOL" Hex === Nothing
which was failing and now it's commented https://github.com/rightfold/purescript-bytestrings/blob/2d58bc68ac1d3650ee2a4f620057f526043f6352/test/Main.purs#L88-L89we should either update type or fix the bug