-
Notifications
You must be signed in to change notification settings - Fork 201
A little unboxing and strictifying #351
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
Conversation
|
|
||
| -- | Basic type for a socket. | ||
| data Socket = Socket (IORef CInt) CInt {- for Show -} | ||
| data Socket = Socket !(IORef CInt) !CInt {- for Show -} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah... actually, it should probably just be an IORef Validity! That removes the redundancy and also the CInt box in the IORef.
|
I'm traveling. I will look your issues in the next week. |
|
@treeowl Thanks for the PR. Could you please provide a description of this work, as well as a reason for its inclusion? |
|
@eborden, it gets rid of some indirections and unnecessary boxes. What in particular do you find unclear? |
|
@treeowl This isn't necessarily about being unclear. This PR introduces a fair amount of complexity by pulling in prim-ops. Increase complexity brings with it a maintenance burden. I'm curious if the performance benefit here pays for the complexity cost. |
|
I can't say for sure. Using a custom deal for the |
|
@treeowl I would easily approve the |
| -- value. This is similar to 'Data.IORef.mkWeakIORef', but we use it | ||
| -- to avoid keeping the useless 'IORef' wrapper alive. | ||
| mkWeakFromIORef :: IORef a -> b -> IO () -> IO (Weak b) | ||
| mkWeakFromIORef (IORef (STRef r##)) b (IO finalizer) = IO $ \s -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also love to see this function move to its own internal module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I'll move it.
|
I suppose. The thing is that |
I think I agree here... However I also think it won't matter much here.. But I have no objections. |
|
Is |
|
I don't think it's big enough to require CLC approval, just a patch to base would be enough imho. That said, even if it makes it into base, it won't be usable here for a while.. unless you check for base versions. |
|
To make a step forward, may I copy |
|
👍 That sounds like a good step forward. |
|
Done. I would close this issue. @treeowl If you really want to bring prim-ops stuff to |
No description provided.