From 022eca508634a830768200250178f80f168083e5 Mon Sep 17 00:00:00 2001 From: Lars Kuhtz Date: Wed, 24 Apr 2019 19:12:59 -0700 Subject: [PATCH] support network >= 3.0.0 --- Network/Wai/Middleware/Throttle/Internal.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Network/Wai/Middleware/Throttle/Internal.hs b/Network/Wai/Middleware/Throttle/Internal.hs index db074fd..5a9783c 100644 --- a/Network/Wai/Middleware/Throttle/Internal.hs +++ b/Network/Wai/Middleware/Throttle/Internal.hs @@ -14,7 +14,7 @@ import Data.Hashable (Hashable, hashWithSalt) import GHC.Word (Word64) import Network.HTTP.Types.Status (status429) import Network.Socket (SockAddr (SockAddrInet, SockAddrInet6, SockAddrUnix)) -#if MIN_VERSION_network(2,6,1) +#if MIN_VERSION_network(2,6,1) && ! MIN_VERSION_network(3,0,0) import Network.Socket (SockAddr (SockAddrCan)) #endif import Network.Wai (Application, Request, Response, remoteHost, responseLBS) @@ -26,7 +26,7 @@ instance Hashable Address where hashWithSalt s (Address (SockAddrInet _ a)) = hashWithSalt s a hashWithSalt s (Address (SockAddrInet6 _ _ a _)) = hashWithSalt s a hashWithSalt s (Address (SockAddrUnix a)) = hashWithSalt s a -#if MIN_VERSION_network(2,6,1) +#if MIN_VERSION_network(2,6,1) && ! MIN_VERSION_network(3,0,0) hashWithSalt s (Address (SockAddrCan a)) = hashWithSalt s a #endif @@ -34,7 +34,7 @@ instance Eq Address where Address (SockAddrInet _ a) == Address (SockAddrInet _ b) = a == b Address (SockAddrInet6 _ _ a _) == Address (SockAddrInet6 _ _ b _) = a == b Address (SockAddrUnix a) == Address (SockAddrUnix b) = a == b -#if MIN_VERSION_network(2,6,1) +#if MIN_VERSION_network(2,6,1) && ! MIN_VERSION_network(3,0,0) Address (SockAddrCan a) == Address (SockAddrCan b) = a == b #endif _ == _ = False -- not same constructor so cant be equal @@ -43,7 +43,7 @@ instance Ord Address where Address (SockAddrInet _ a) <= Address (SockAddrInet _ b) = a <= b Address (SockAddrInet6 _ _ a _) <= Address (SockAddrInet6 _ _ b _) = a <= b Address (SockAddrUnix a) <= Address (SockAddrUnix b) = a <= b -#if MIN_VERSION_network(2,6,1) +#if MIN_VERSION_network(2,6,1) && ! MIN_VERSION_network(3,0,0) Address (SockAddrCan a) <= Address (SockAddrCan b) = a <= b #endif Address a <= Address b = a <= b -- not same constructor so use builtin ordering