Skip to content

Commit

Permalink
Replace exceptions dependency with safe-exceptions (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocharles committed Oct 4, 2022
1 parent c47d867 commit a5b4824
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions hedgehog/hedgehog.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ library
, primitive >= 0.6 && < 0.8
, random >= 1.1 && < 1.3
, resourcet >= 1.1 && < 1.3
, safe-exceptions >= 0.1 && < 0.2
, stm >= 2.4 && < 2.6
, template-haskell >= 2.10 && < 2.20
, text >= 1.1 && < 2.1
Expand Down
2 changes: 1 addition & 1 deletion hedgehog/src/Hedgehog/Internal/Exception.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Hedgehog.Internal.Exception (
) where

import Control.Exception (Exception(..), AsyncException, SomeException(..), evaluate)
import Control.Monad.Catch (MonadCatch(..), throwM)
import Control.Exception.Safe (MonadCatch, catch, throwM)

import System.IO.Unsafe (unsafePerformIO)

Expand Down
2 changes: 1 addition & 1 deletion hedgehog/src/Hedgehog/Internal/Gen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ module Hedgehog.Internal.Gen (
import Control.Applicative (Alternative(..),liftA2)
import Control.Monad (MonadPlus(..), filterM, guard, replicateM, join)
import Control.Monad.Base (MonadBase(..))
import Control.Monad.Catch (MonadThrow(throwM), MonadCatch(catch))
import Control.Monad.Trans.Control (MonadBaseControl(..))
import Control.Monad.Catch (MonadThrow(..), MonadCatch(..))
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Morph (MFunctor(..), MMonad(..))
Expand Down
4 changes: 2 additions & 2 deletions hedgehog/src/Hedgehog/Internal/Property.hs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ module Hedgehog.Internal.Property (

import Control.Applicative (Alternative(..))
import Control.DeepSeq (NFData, rnf)
import Control.Exception.Safe (MonadThrow, MonadCatch)
import Control.Exception.Safe (SomeException(..), displayException)
import Control.Monad (MonadPlus(..), (<=<))
import Control.Monad.Base (MonadBase(..))
import Control.Monad.Catch (MonadThrow(..), MonadCatch(..))
import Control.Monad.Catch (SomeException(..), displayException)
import Control.Monad.Error.Class (MonadError(..))
import qualified Control.Monad.Fail as Fail
import Control.Monad.IO.Class (MonadIO(..))
Expand Down
2 changes: 1 addition & 1 deletion hedgehog/src/Hedgehog/Internal/Region.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Hedgehog.Internal.Region (
import Control.Concurrent.STM (STM, TVar)
import qualified Control.Concurrent.STM.TMVar as TMVar
import qualified Control.Concurrent.STM.TVar as TVar
import Control.Monad.Catch (MonadMask(..), bracket)
import Control.Exception.Safe (MonadMask, bracket)
import Control.Monad.IO.Class (MonadIO(..))

import System.Console.Regions (ConsoleRegion, RegionLayout(..), LiftRegion(..))
Expand Down
4 changes: 2 additions & 2 deletions hedgehog/src/Hedgehog/Internal/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Hedgehog.Internal.Runner (

import Control.Concurrent.STM (TVar, atomically)
import qualified Control.Concurrent.STM.TVar as TVar
import Control.Monad.Catch (MonadCatch(..), catchAll)
import Control.Exception.Safe (MonadCatch, catchAny)
import Control.Monad.IO.Class (MonadIO(..))
import Data.Maybe (isJust)

Expand Down Expand Up @@ -226,7 +226,7 @@ checkReport cfg size0 seed0 test0 updateUI = do
(Just t, Just s)

test =
catchAll test0 (fail . show)
catchAny test0 (fail . show)

terminationCriteria =
propertyTerminationCriteria cfg
Expand Down
2 changes: 1 addition & 1 deletion hedgehog/src/Hedgehog/Internal/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ module Hedgehog.Internal.State (
) where

import qualified Control.Concurrent.Async.Lifted as Async
import Control.Exception.Safe (MonadCatch)
import Control.Monad (foldM, foldM_)
import Control.Monad.Catch (MonadCatch)
import Control.Monad.State.Class (MonadState, get, put, modify)
import Control.Monad.Morph (MFunctor(..))
import Control.Monad.Trans.Class (lift)
Expand Down
3 changes: 2 additions & 1 deletion hedgehog/src/Hedgehog/Internal/Tree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ module Hedgehog.Internal.Tree (
) where

import Control.Applicative (Alternative(..), liftA2)
import Control.Exception.Safe (Exception)
import Control.Monad (MonadPlus(..), guard, join)
import Control.Monad.Base (MonadBase(..))
import Control.Monad.Catch (MonadThrow(throwM), MonadCatch(catch))
import Control.Monad.Trans.Control ()
import Control.Monad.Catch (MonadThrow(..), MonadCatch(..), Exception)
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Morph (MFunctor(..), MMonad(..), generalize)
Expand Down

0 comments on commit a5b4824

Please sign in to comment.