Description: Correctly retrieve the type of the socket
 On mips, `SOCK_STREAM` and `SOCK_DGRAM` have different values than on
 x86_64. Modify `getSockType` to use functions from the Network library
 to retrieve the type of the socket, instead of relying on hard-coded
 values.
Author: Ilias Tsitsimpis <iliastsi@debian.org>
Bug: https://github.com/snapframework/io-streams-haproxy/issues/18

Index: b/io-streams-haproxy.cabal
===================================================================
--- a/io-streams-haproxy.cabal
+++ b/io-streams-haproxy.cabal
@@ -39,7 +39,7 @@ library
                      attoparsec        >= 0.7 && < 0.14,
                      bytestring        >= 0.9 && < 0.11,
                      io-streams        >= 1.3 && < 1.6,
-                     network           >= 2.3 && < 3.1,
+                     network           (>= 2.3 && < 3.0.0.0) || (>= 3.0.1.0 && < 3.2),
                      transformers      >= 0.3 && < 0.6
   default-language:  Haskell2010
 
Index: b/src/System/IO/Streams/Network/HAProxy.hs
===================================================================
--- a/src/System/IO/Streams/Network/HAProxy.hs
+++ b/src/System/IO/Streams/Network/HAProxy.hs
@@ -72,15 +72,8 @@ socketToProxyInfo s sa = do
     !sty <- getSockType
     return $! makeProxyInfo sa da (addrFamily sa) sty
   where
-#if MIN_VERSION_network(2,7,0)
-    getSockType = do
-        c <- N.getSocketOption s N.Type
-        -- This is a kludge until network has better support for returning
-        -- SocketType
-        case c of
-          1 -> return N.Stream
-          2 -> return N.Datagram
-          _ -> error ("bad socket type: " ++ show c)
+#if MIN_VERSION_network(3,0,1)
+    getSockType = getSocketType s
 #else
     getSockType = let (N.MkSocket _ _ sty _ _) = s in return sty
 #endif
