diff options
Diffstat (limited to 'src/BTLS/Result.hs')
-rw-r--r-- | src/BTLS/Result.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/BTLS/Result.hs b/src/BTLS/Result.hs index a3c153c..f75d89e 100644 --- a/src/BTLS/Result.hs +++ b/src/BTLS/Result.hs @@ -15,7 +15,7 @@ module BTLS.Result ( alwaysSucceeds, requireSuccess , Result, Error, file, line, errorData, errorDataIsHumanReadable - , check + , check, check' ) where import Control.Concurrent (rtsSupportsBoundThreads, runInBoundThread) @@ -70,10 +70,13 @@ dequeueError = do return (Just (errorFromTuple e)) check :: IO Int -> ExceptT [Error] IO () -check f = do +check = ExceptT . check' + +check' :: IO Int -> IO (Either [Error] ()) +check' f = do unless rtsSupportsBoundThreads $ error "btls requires the threaded runtime. Please recompile with -threaded." - ExceptT $ runInBoundThread $ do + runInBoundThread $ do -- TODO(bbaren): Assert that the error queue is clear r <- f if r == 1 |