Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Network.Socket: Added CustomSockOpt data constructor for SocketOption #123

merged 1 commit into from

2 participants


This patch allows socket options to be packed manually. This is useful if a new or obscure socket option is required and does not yet exist as a constructor. For example, TCP_DEFER_ACCEPT is not presently supported.

@tibbe tibbe merged commit 6323e3f into haskell:master

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +2 −0  Network/Socket.hsc
2  Network/Socket.hsc
@@ -845,6 +845,7 @@ data SocketOption
| SendTimeOut -- ^ SO_SNDTIMEO
| UseLoopBack -- ^ SO_USELOOPBACK
| IPv6Only -- ^ IPV6_V6ONLY
+ | CustomSockOpt (CInt, CInt)
deriving (Show, Typeable)
-- | Does the 'SocketOption' exist on this system?
@@ -941,6 +942,7 @@ packSocketOption so =
Just IPv6Only -> Just ((#const IPPROTO_IPV6), (#const IPV6_V6ONLY))
+ Just (CustomSockOpt opt) -> Just opt
_ -> Nothing
-- | Return the option level and option value if they exist,
Something went wrong with that request. Please try again.