File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 8
8
9
9
### Non-breaking changes
10
10
11
+ * ` Alternative ` & ` MonadPlus ` instances for ` IOSim ` .
12
+
11
13
## 1.3.1.0
12
14
13
15
### Non-breaking changes
Original file line number Diff line number Diff line change 12
12
{-# LANGUAGE NumericUnderscores #-}
13
13
{-# LANGUAGE PatternSynonyms #-}
14
14
{-# LANGUAGE RankNTypes #-}
15
+ {-# LANGUAGE ScopedTypeVariables #-}
15
16
{-# LANGUAGE TypeFamilies #-}
16
17
17
18
-- Needed for `SimEvent` type.
@@ -136,6 +137,7 @@ import Control.Monad.IOSimPOR.Types
136
137
137
138
import qualified System.IO.Error as IO.Error (userError )
138
139
import Data.List (intercalate )
140
+ import GHC.IO (mkUserError )
139
141
140
142
{-# ANN module "HLint: ignore Use readTVarIO" #-}
141
143
newtype IOSim s a = IOSim { unIOSim :: forall r . (a -> SimA s r ) -> SimA s r }
@@ -287,6 +289,11 @@ instance Fail.MonadFail (IOSim s) where
287
289
instance MonadFix (IOSim s ) where
288
290
mfix f = IOSim $ oneShot $ \ k -> Fix f k
289
291
292
+ instance Alternative (IOSim s ) where
293
+ empty = throwIO (mkUserError " mzero" )
294
+ ! a <|> b = a `catch` \ (_ :: IOError ) -> b
295
+
296
+ instance MonadPlus (IOSim s )
290
297
291
298
instance Functor (STM s ) where
292
299
{-# INLINE fmap #-}
You can’t perform that action at this time.
0 commit comments