From 2de2f05196cd7a947d52a56881107be8bf0bd6a2 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Sat, 16 Nov 2024 13:45:00 +0900 Subject: [PATCH] removing async --- tls/Network/TLS/Util.hs | 13 +++++++++---- tls/tls.cabal | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tls/Network/TLS/Util.hs b/tls/Network/TLS/Util.hs index 109e5c1ee..94d0dcc70 100644 --- a/tls/Network/TLS/Util.hs +++ b/tls/Network/TLS/Util.hs @@ -19,9 +19,9 @@ module Network.TLS.Util ( import qualified Data.ByteString as B import Network.TLS.Imports -import Control.Concurrent.Async import Control.Concurrent.MVar -import Control.Exception (SomeException) +import Control.Exception (SomeAsyncException (..)) +import qualified Control.Exception as E sub :: ByteString -> Int -> Int -> Maybe ByteString sub b offset len @@ -69,8 +69,13 @@ False &&! False = False fmapEither :: (a -> b) -> Either l a -> Either l b fmapEither f = fmap f -catchException :: IO a -> (SomeException -> IO a) -> IO a -catchException action handler = withAsync action waitCatch >>= either handler return +catchException :: IO a -> (E.SomeException -> IO a) -> IO a +catchException f handler = E.catchJust filterExn f handler + where + filterExn :: E.SomeException -> Maybe E.SomeException + filterExn e = case E.fromException (E.toException e) of + Just (SomeAsyncException _) -> Nothing + Nothing -> Just e forEitherM :: Monad m => [a] -> (a -> m (Either l b)) -> m (Either l [b]) forEitherM [] _ = return (pure []) diff --git a/tls/tls.cabal b/tls/tls.cabal index d74c787fe..fc0177062 100644 --- a/tls/tls.cabal +++ b/tls/tls.cabal @@ -114,7 +114,6 @@ library base >=4.9 && <5, asn1-encoding >= 0.9 && < 0.10, asn1-types >= 0.3 && < 0.4, - async >= 2.2 && < 2.3, base16-bytestring, bytestring >= 0.10 && < 0.13, cereal >= 0.5.3 && < 0.6,