File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
io-sim/src/Control/Monad/IOSim Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ import Data.Typeable (Typeable)
59
59
import Quiet (Quiet (.. ))
60
60
import GHC.Generics (Generic )
61
61
62
- import Control.Applicative (Alternative (.. ))
62
+ import Control.Applicative (Alternative (.. ), liftA2 )
63
63
import Control.Exception (ErrorCall (.. ), assert ,
64
64
asyncExceptionFromException , asyncExceptionToException )
65
65
import Control.Monad (MonadPlus , join )
@@ -195,6 +195,16 @@ instance Monad (IOSim s) where
195
195
fail = Fail. fail
196
196
#endif
197
197
198
+ instance Semigroup a => Semigroup (IOSim s a ) where
199
+ (<>) = liftA2 (<>)
200
+
201
+ instance Monoid a => Monoid (IOSim s a ) where
202
+ mempty = pure mempty
203
+
204
+ #if !(MIN_VERSION_base(4,11,0))
205
+ mappend = liftA2 mappend
206
+ #endif
207
+
198
208
instance Fail. MonadFail (IOSim s ) where
199
209
fail msg = IOSim $ \ _ -> Throw (toException (IO.Error. userError msg))
200
210
@@ -236,7 +246,6 @@ instance Alternative (STM s) where
236
246
237
247
instance MonadPlus (STM s ) where
238
248
239
-
240
249
instance MonadSay (IOSim s ) where
241
250
say msg = IOSim $ \ k -> Say msg (k () )
242
251
You can’t perform that action at this time.
0 commit comments