Skip to content
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

Open
hasufell opened this issue Jul 16, 2022 · 2 comments
Open

Binary instances for OsString, etc. #161

hasufell opened this issue Jul 16, 2022 · 2 comments

Comments

@hasufell
Copy link
Member

In GitLab by @phadej on Jul 17, 2022, 03:04

Where these should be?

  1. binary (then binary would depend on filepath)
  2. filepath (then filepath would depend on binary)
  3. somewhere else? (https://hackage.haskell.org/package/binary-instances or new filepath-binary-instances).

I don't know if how GHC serializes its stuff, but I bet there are filepaths in there. (Cabal does, and uses Generics). So that rules out third option, except if it's a new filepath-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

@hasufell
Copy link
Member Author

In GitLab by @maerwald on Jul 17, 2022, 04:12

To me it seems fine if binary depends on filepath.

What would the instance actually do? Just unwrap the underlying ShortByteString? Remember that we have two different constructors for unix and windows:

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?

@hasufell
Copy link
Member Author

In GitLab by @phadej on Jul 17, 2022, 04:17

To me it seems fine if binary depends on filepath.

It's not. filepath is already dependency heavy: through exceptions it depends on mtl, transformers, and stm. IMO adding binary to the list is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant