Skip to content

Commit 24eccd3

Browse files
iohk-bors[bot]coot
andauthored
Merge #2875
2875: Allow to acquire tip by LocalStateQuery protocol client. r=coot a=coot * Change mini-protocol description * Redefine codec, add a test which ensures that the new version of the codec is compatible with the previous one. * Updated consensus, including the server. * Added new supported version in `ouroboros-consensus-cardano` As a bonus: * `instance Monoid a => Monoid (IOSim s a)` Co-authored-by: Marcin Szamotulski <[email protected]>
2 parents 9d7fd71 + 3d52c73 commit 24eccd3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

io-sim/src/Control/Monad/IOSim/Internal.hs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import Data.Typeable (Typeable)
5959
import Quiet (Quiet (..))
6060
import GHC.Generics (Generic)
6161

62-
import Control.Applicative (Alternative (..))
62+
import Control.Applicative (Alternative (..), liftA2)
6363
import Control.Exception (ErrorCall (..), assert,
6464
asyncExceptionFromException, asyncExceptionToException)
6565
import Control.Monad (MonadPlus, join)
@@ -195,6 +195,16 @@ instance Monad (IOSim s) where
195195
fail = Fail.fail
196196
#endif
197197

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+
198208
instance Fail.MonadFail (IOSim s) where
199209
fail msg = IOSim $ \_ -> Throw (toException (IO.Error.userError msg))
200210

@@ -236,7 +246,6 @@ instance Alternative (STM s) where
236246

237247
instance MonadPlus (STM s) where
238248

239-
240249
instance MonadSay (IOSim s) where
241250
say msg = IOSim $ \k -> Say msg (k ())
242251

0 commit comments

Comments
 (0)