Skip to content

Commit 1b33c7f

Browse files
committed
monad-stm: added missing MArray instance
1 parent 1073966 commit 1b33c7f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

io-classes/src/Control/Monad/Class/MonadSTM/Internal.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,9 +1321,15 @@ deriving instance MonadSTM m => MonadPlus (WrappedSTM t r m)
13211321

13221322
instance ( Semigroup a, MonadSTM m ) => Semigroup (WrappedSTM t r m a) where
13231323
a <> b = (<>) <$> a <*> b
1324-
instance ( Monoid a , MonadSTM m ) => Monoid (WrappedSTM t r m a) where
1324+
instance ( Monoid a, MonadSTM m ) => Monoid (WrappedSTM t r m a) where
13251325
mempty = pure mempty
13261326

1327+
instance ( MonadSTM m, MArray e a (STM m) ) => MArray e a (WrappedSTM t r m) where
1328+
getBounds = WrappedSTM . getBounds
1329+
getNumElements = WrappedSTM . getNumElements
1330+
unsafeRead arr = WrappedSTM . unsafeRead arr
1331+
unsafeWrite arr i = WrappedSTM . unsafeWrite arr i
1332+
13271333

13281334
-- note: this (and the following) instance requires 'UndecidableInstances'
13291335
-- extension because it violates 3rd Paterson condition, however `STM m` will

0 commit comments

Comments
 (0)