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

Update to v0.14.0-rc3 #4

merged 5 commits into from
Dec 12, 2020

Conversation

JordanMartinez
Copy link
Contributor

@JordanMartinez
Copy link
Contributor Author

CI will fail until node-fs is updated

@JordanMartinez
Copy link
Contributor Author

CI is failing with this error:

[1/1 NoInstanceFound] test/Test/Main.purs:47:13

  47              logShow { _message: "Received some data", buffer }
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  No type class instance was found for
  
    Data.Show.Show Buffer
  
  while applying a function logShow
    of type Show t2 => t2 -> Effect Unit
    to argument { _message: "Received some data"
                , buffer: buffer
                }
  while checking that expression logShow { _message: "Received some data"
                                         , buffer: buffer
                                         }
    has type t0 t1
  in value declaration main
  
  where t1 is an unknown type
        t0 is an unknown type
        t2 is an unknown type

@hdgarrood
Copy link
Member

Buffer can’t have a Show instance which provides any useful information because that would violate purity - it’s a mutable reference type. I think the test code should be amended so that we are just showing the result of reading the buffer as a string, not showing the buffer itself.

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

Copy link
Contributor

@thomashoneyman thomashoneyman left a comment

Choose a reason for hiding this comment

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

👍 as far as 0.14.0-rc3 changes go.

@JordanMartinez JordanMartinez merged commit 2ba2d18 into purescript-node:master Dec 12, 2020
@JordanMartinez JordanMartinez deleted the updateTo14 branch December 12, 2020 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants