Skip to content

Commit 831f1aa

Browse files
committed
FIX: UnsupportedSocketOption pattern short-circuit
adds pattern UnsupportedSocketOption for short-circuit, as addendum to previous commit. Also adds export of said pattern to Network.Socket
1 parent f77142f commit 831f1aa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Network/Socket.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ module Network.Socket
134134

135135
-- * Socket options
136136
, SocketOption(SockOpt
137+
,UnsupportedSocketOption
137138
,Debug,ReuseAddr,SoDomain,Type,SoProtocol,SoError,DontRoute
138139
,Broadcast,SendBuffer,RecvBuffer,KeepAlive,OOBInline
139140
,TimeToLive,MaxSegment,NoDelay,Cork,Linger,ReusePort

Network/Socket/Options.hsc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ isSupportedSocketOption opt = opt /= SockOpt (-1) (-1)
6363
getSocketType :: Socket -> IO SocketType
6464
getSocketType s = unpackSocketType <$> getSockOpt s Type
6565

66+
pattern UnsupportedSocketOption :: SocketOption
67+
pattern UnsupportedSocketOption = SockOpt (-1) (-1)
68+
6669
#ifdef SOL_SOCKET
6770
-- | SO_DEBUG
6871
pattern Debug :: SocketOption
@@ -388,7 +391,7 @@ getSockOpt s (SockOpt level opt) = do
388391

389392
socketOptionPairs :: [Pair SocketOption String]
390393
socketOptionPairs =
391-
[ (SockOpt -1 -1, "Unsupported")
394+
[ (UnsupportedSocketOption, "Unsupported")
392395
, (Debug, "Debug")
393396
, (ReuseAddr, "ReuseAddr")
394397
, (SoDomain, "SoDomain")

0 commit comments

Comments
 (0)