-
Notifications
You must be signed in to change notification settings - Fork 32
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
Binary instances for OsString
, etc.
#161
Comments
In GitLab by @maerwald on Jul 17, 2022, 04:12 To me it seems fine if What would the instance actually do? Just unwrap the underlying newtype WindowsString = WindowsString ShortByteString
newtype PosixString = PosixString ShortByteString
newtype OsString = OsString
#if defined(mingw32_HOST_OS)
WindowsString
#else
PosixString
#endif Should you be able to encode on unix, send the bytestring over the wire and decode on windows? What are the semantics? |
In GitLab by @phadej on Jul 17, 2022, 04:17
It's not. |
I've recently been benchmarking GHC building Cabal and Is there anyway to make progress here? I don't mind spending some cycles to open the appropriate MR/PR |
What would the semantics of the instance be? |
Ah, well I suppose I can just write the Now to actually answer your question. My inclination is just to unpack to short bytestring. I'm suspicious that the solicited problem of |
So you're saying that:
Is that correct? How would the
|
Both of these could be solved with a sentinel value in the Binary instances and this would only require one bit as well. So we:
So I have in mind something like this in
and then:
of course we would need to also store the number of bytes to read on a Note that reading some of the binary instances in GHC I'm not sure if that's actually necessary since they don't do that much hand holding. But in any case that's the idea. |
Both The only type that needs to check that it matches the current platform is |
I would prefer |
Ah I see, in that case perhaps its better not to provide binary instances but rather functions that would do the serialization. That would allow binary to depend on |
In GitLab by @phadej on Jul 17, 2022, 03:04
Where these should be?
binary
(thenbinary
would depend onfilepath
)filepath
(thenfilepath
would depend onbinary
)filepath-binary-instances
).I don't know if how GHC serializes its stuff, but I bet there are filepaths in there. (
Cabal
does, and usesGeneric
s). So that rules out third option, except if it's a newfilepath-binary-instances
package which is bundled with GHC.Otherwise I'd prefer second option, so the type-class providing package stays as dependency-light as possible.
ping @bgamari
The text was updated successfully, but these errors were encountered: