mirror of
https://github.com/barrucadu/dejafu.git
synced 2024-12-18 11:01:50 +03:00
Add missing MonadFail instances (when base >=4.9) for ConcT/STM
Closes #136
This commit is contained in:
parent
a0801d65eb
commit
e9a64a1f8d
@ -14,6 +14,14 @@ unreleased
|
|||||||
|
|
||||||
- Fix some incorrect "@since" haddock comments.
|
- Fix some incorrect "@since" haddock comments.
|
||||||
|
|
||||||
|
### Test.DejaFu.Conc
|
||||||
|
|
||||||
|
- Add a missing `MonadFail` instance.
|
||||||
|
|
||||||
|
### Test.DejaFu.STM
|
||||||
|
|
||||||
|
- Add a missing `MonadFail` instance.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
@ -11,7 +12,7 @@
|
|||||||
-- License : MIT
|
-- License : MIT
|
||||||
-- Maintainer : Michael Walker <mike@barrucadu.co.uk>
|
-- Maintainer : Michael Walker <mike@barrucadu.co.uk>
|
||||||
-- Stability : experimental
|
-- Stability : experimental
|
||||||
-- Portability : FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, RankNTypes, TypeFamilies, TypeSynonymInstances
|
-- Portability : CPP, FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, RankNTypes, TypeFamilies, TypeSynonymInstances
|
||||||
--
|
--
|
||||||
-- Deterministic traced execution of concurrent computations.
|
-- Deterministic traced execution of concurrent computations.
|
||||||
--
|
--
|
||||||
@ -65,9 +66,19 @@ import Test.DejaFu.Conc.Internal
|
|||||||
import Test.DejaFu.Conc.Internal.Common
|
import Test.DejaFu.Conc.Internal.Common
|
||||||
import Test.DejaFu.STM
|
import Test.DejaFu.STM
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,9,0)
|
||||||
|
import qualified Control.Monad.Fail as Fail
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | @since 0.6.0.0
|
-- | @since 0.6.0.0
|
||||||
newtype ConcT r n a = C { unC :: M n r a } deriving (Functor, Applicative, Monad)
|
newtype ConcT r n a = C { unC :: M n r a } deriving (Functor, Applicative, Monad)
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,9,0)
|
||||||
|
-- | @since unreleased
|
||||||
|
instance Fail.MonadFail (ConcT r n) where
|
||||||
|
fail = C . fail
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | A 'MonadConc' implementation using @ST@, this should be preferred
|
-- | A 'MonadConc' implementation using @ST@, this should be preferred
|
||||||
-- if you do not need 'liftIO'.
|
-- if you do not need 'liftIO'.
|
||||||
--
|
--
|
||||||
|
@ -39,9 +39,19 @@ import qualified Control.Monad.STM.Class as C
|
|||||||
import Test.DejaFu.Common
|
import Test.DejaFu.Common
|
||||||
import Test.DejaFu.STM.Internal
|
import Test.DejaFu.STM.Internal
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,9,0)
|
||||||
|
import qualified Control.Monad.Fail as Fail
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | @since 0.3.0.0
|
-- | @since 0.3.0.0
|
||||||
newtype STMLike n r a = S { runSTM :: M n r a } deriving (Functor, Applicative, Monad)
|
newtype STMLike n r a = S { runSTM :: M n r a } deriving (Functor, Applicative, Monad)
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,9,0)
|
||||||
|
-- | @since unreleased
|
||||||
|
instance Fail.MonadFail (STMLike r n) where
|
||||||
|
fail = S . fail
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | Create a new STM continuation.
|
-- | Create a new STM continuation.
|
||||||
toSTM :: ((a -> STMAction n r) -> STMAction n r) -> STMLike n r a
|
toSTM :: ((a -> STMAction n r) -> STMAction n r) -> STMLike n r a
|
||||||
toSTM = S . cont
|
toSTM = S . cont
|
||||||
|
Loading…
Reference in New Issue
Block a user