Skip to content

Update to v0.14.0-rc3 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "0.14.0-rc3"

- uses: actions/setup-node@v1
with:
Expand Down
24 changes: 12 additions & 12 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
"output"
],
"dependencies": {
"purescript-effect": ">= 1.0.0 < 3",
"purescript-either": ">= 1.0.0 < 5",
"purescript-exceptions": ">= 4.0.0 < 5",
"purescript-foreign": ">= 5.0.0 < 6",
"purescript-maybe": ">= 1.0.0 < 5",
"purescript-node-buffer": ">= 5.0.0 < 6",
"purescript-node-fs": ">= 5.0.0 < 6",
"purescript-nullable": ">= 3.0.0 < 5",
"purescript-options": ">= 1.0.0 < 6",
"purescript-prelude": ">= 4.0.0 < 5",
"purescript-transformers": ">= 1.0.0 < 5"
"purescript-effect": "master",
"purescript-either": "master",
"purescript-exceptions": "master",
"purescript-foreign": "master",
"purescript-maybe": "master",
"purescript-node-buffer": "master",
"purescript-node-fs": "master",
"purescript-nullable": "main",
"purescript-options": "main",
"purescript-prelude": "master",
"purescript-transformers": "master"
},
"devDependencies": {
"purescript-console": ">= 4.0.0 < 5"
"purescript-console": "master"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "eslint src && pulp build -- --censor-lib --strict",
"test": "pulp test"
"test": "pulp test -- --censor-lib"
},
"devDependencies": {
"eslint": "^7.15.0",
Expand Down
5 changes: 3 additions & 2 deletions test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ main = do
infoShow {_message: "Socket connected"}
Node.Net.Socket.onData socket case _ of
Left buffer -> do
logShow { _message: "Received some data", buffer }
bufferBinary <- toString Binary buffer
logShow { _message: "Received some data", bufferBinary }
bufferString <- toString UTF8 buffer
logShow { _message: "Converted to a `String`", buffer, bufferString }
logShow { _message: "Converted to a `String`", bufferString }
Right string -> logShow { _message: "Received some data", string }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this would make a bigger difference, but apparently not:

{ _message: "Received some data", bufferBinary: "Hello socket\nServer is ending connection\n" }
{ _message: "Converted to a `String`", bufferString: "Hello socket\nServer is ending connection\n" }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is correct behavior or not, but I don't think it should hold up a 0.14.0-rc3 merge.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you expect? This looks reasonable to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described in https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings, "Binary" is a deprecated alias for "latin1". This particular string only includes ASCII characters, which means that it decodes the same way regardless of whether you interpret it as latin1 or utf-8. You'd only see differences if you had code points above 127.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this to get this done, but should we drop the 'bufferBinary' one completely since 'Binary' is deprecated (and so I imagine we'll remove it at some point in the future)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that sounds good to me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keep in mind that we need to preserve compatibility back to the last supported Node version.

I checked, and binary was aliased to latin1 all the way back in Node 10, so perhaps it's safe to only provide latin1 here.

But perhaps the philosophy of this library is to stay faithful to the underlying supported encodings, in which case we would include 'binary', even though it's considered deprecated and simply an alias for latin1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant removing the line in these tests which calls toString Binary, not removing the Binary constructor itself. (That's probably worth discussing too, though).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #5

Node.Net.Socket.onDrain socket do
infoShow { _message: "Socket drained" }
Expand Down