Skip to content

Conversation

@kazu-yamamoto
Copy link
Collaborator

As David Feuer suggested in haskell-cafe, the CustomSockOpt pattern can be defined with ViewPatterns.

Relating to #414.

@kazu-yamamoto kazu-yamamoto requested a review from eborden May 18, 2020 06:25
@kazu-yamamoto
Copy link
Collaborator Author

If we want, we can make CustomSockOpt deprecated suggesting getSockOpt and setSockOpt.

Copy link
Contributor

@treeowl treeowl left a comment

Choose a reason for hiding this comment

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

Don't forget the COMPLETE pragma in case someone decides to use -Wincomplete-patterns.

@kazu-yamamoto
Copy link
Collaborator Author

@treeowl Do you suggest the following?

{-# COMPLETE Debug,ReuseAddr,Type,SoError,DontRoute,Broadcast
            ,SendBuffer,RecvBuffer,KeepAlive,OOBInline,TimeToLive
            ,MaxSegment,NoDelay,Cork,Linger,ReusePort
            ,RecvLowWater,SendLowWater,RecvTimeOut,SendTimeOut
            ,UseLoopBack,UserTimeout,IPv6Only
            ,RecvIPv4TTL,RecvIPv4TOS,RecvIPv4PktInfo
            ,RecvIPv6HopLimit,RecvIPv6TClass,RecvIPv6PktInfo
            ,CustomSockOpt #-}

@treeowl
Copy link
Contributor

treeowl commented May 18, 2020

CustomSockOpt is complete all by itself, right? If so, it gets its own pragma. It seems unlikely any of those others combine to form a complete set, but I'm no expert. I would imagine

{-# COMPLETE CustomSockOpt #-}

@eborden
Copy link
Collaborator

eborden commented May 18, 2020

Good call on COMPLETE. That is necessary to maintain a backwards compatible interface. CustomSockOpt does represent an otherwise case, so it is complete on its own. I also agree that the other patterns do not represent a complete set, since SocketOption is now open to extension.

@kazu-yamamoto
Copy link
Collaborator Author

@treeowl @eborden Thank you for your clarification.

Are we ready for merging?

@treeowl
Copy link
Contributor

treeowl commented May 18, 2020

The pattern synonym looks fine. Can't comment on how it all fits with the rest of the library, because I'm not familiar with that.

@kazu-yamamoto
Copy link
Collaborator Author

Rebased just in case.

@kazu-yamamoto kazu-yamamoto merged commit 11abcef into haskell:master May 18, 2020
@kazu-yamamoto
Copy link
Collaborator Author

Merged. Thank you for your review!

@kazu-yamamoto kazu-yamamoto deleted the custom-sockopt branch May 18, 2020 23:43
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