@@ -17,7 +17,6 @@ module Data.Yaml.Internal
17import Control.Applicative ((<$>), Applicative(..))
17import Control.Applicative ((<$>), Applicative(..))
19import Control.Exception
19import Control.Exception
20−import Control.Exception.Enclosed
21import Control.Monad (liftM, ap, unless)
20import Control.Monad (liftM, ap, unless)
22import Control.Monad.IO.Class (MonadIO, liftIO)
21import Control.Monad.IO.Class (MonadIO, liftIO)
23import Control.Monad.Trans.Class (MonadTrans, lift)
22import Control.Monad.Trans.Class (MonadTrans, lift)
@@ -253,7 +252,10 @@ decodeHelper :: FromJSON a
253 => C.Source Parse Y.Event
252 => C.Source Parse Y.Event
254 -> IO (Either ParseException (Either String a))
253 -> IO (Either ParseException (Either String a))
255decodeHelper src = do
254decodeHelper src = do
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.
256− x <- tryAny $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
258+ x <- try $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
257 case x of
259 case x of
259 | Just pe <- fromException e -> return $ Left pe
261 | Just pe <- fromException e -> return $ Left pe
@@ -265,7 +267,7 @@ decodeHelper_ :: FromJSON a
265 => C.Source Parse Event
267 => C.Source Parse Event
266 -> IO (Either ParseException a)
268 -> IO (Either ParseException a)
267decodeHelper_ src = do
269decodeHelper_ src = do
268− x <- tryAny $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
270+ x <- try $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
269 return $ case x of
271 return $ case x of
271 | Just pe <- fromException e -> Left pe
273 | Just pe <- fromException e -> Left pe