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

Allow to specify Connection in execClient #3

Open
Martoon-00 opened this issue Oct 5, 2016 · 1 comment
Open

Allow to specify Connection in execClient #3

Martoon-00 opened this issue Oct 5, 2016 · 1 comment

Comments

@Martoon-00
Copy link

Martoon-00 commented Oct 5, 2016

In our application we may need to keep a routing table (Map (S.ByteString, Int) Connection) and so reuse connections. But implementation of it requires execClient to take Connection as argument.
Is it acceptable to create following functions:
execClientWithConn :: Client a -> StateT Connection IO a
initConn :: ByteString -> Int -> IO Connection
closeConn :: Connection -> IO ()
and put them into Network.MessagePack.Client.Internal?

@iphydf
Copy link
Member

iphydf commented Oct 6, 2016

Ok, seems reasonable. Make sure to:

  1. Write execClientWithConn :: ClientT m a -> StateT Connection m a to allow IO wrappers.
  2. Add an export list to the Internal module, because you're going to export that module now, and we don't want to expose more than necessary. You may need to restructure things a bit, because currently the Internal module is written with the idea that it won't be exposed in the library. E.g. we still want the Connection type to be opaque.
  3. Add a comment to the top of the now exposed Internal module that its API is unstable (in reality, the rest of the API is also unstable until release 1.0, but for internal stuff it makes sense to be more explicit about it).

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

No branches or pull requests

2 participants