@@ -17,7 +17,6 @@ module Data.Yaml.Internal
1717import Control.Applicative ((<$>), Applicative(..))
1818#endif
1919import Control.Exception
20−import Control.Exception.Enclosed
2120import Control.Monad (liftM, ap, unless)
2221import Control.Monad.IO.Class (MonadIO, liftIO)
2322import Control.Monad.Trans.Class (MonadTrans, lift)
@@ -253,7 +252,10 @@ decodeHelper :: FromJSON a
253252 => C.Source Parse Y.Event
254253 -> IO (Either ParseException (Either String a))
255254decodeHelper src = do
256− x <- tryAny $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
255+ -- This used to be tryAny, but the fact is that catching async
256+ -- exceptions is fine here. We'll rethrow them immediately in the
257+ -- otherwise clause.
258+ x <- try $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
257259 case x of
258260 Left e
259261 | Just pe <- fromException e -> return $ Left pe
@@ -265,7 +267,7 @@ decodeHelper_ :: FromJSON a
265267 => C.Source Parse Event
266268 -> IO (Either ParseException a)
267269decodeHelper_ src = do
268− x <- tryAny $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
270+ x <- try $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
269271 return $ case x of
270272 Left e
271273 | Just pe <- fromException e -> Left pe