File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based
77Breaking changes:
88
99New features:
10+ - Add Semigroup and Monoid instances (#51 by @PureFunctor )
1011
1112Bugfixes:
1213
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module Control.Monad.ST.Internal
1515
1616import Prelude
1717
18+ import Control.Apply (lift2 )
1819import Control.Monad.Rec.Class (class MonadRec , Step (..))
1920import Partial.Unsafe (unsafePartial )
2021
@@ -72,6 +73,12 @@ instance monadRecST :: MonadRec (ST r) where
7273 Loop _ -> true
7374 _ -> false
7475
76+ instance semigroupST :: Semigroup a => Semigroup (ST r a ) where
77+ append = lift2 append
78+
79+ instance monoidST :: Monoid a => Monoid (ST r a ) where
80+ mempty = pure mempty
81+
7582-- | Run an `ST` computation.
7683-- |
7784-- | Note: the type of `run` uses a rank-2 type to constrain the phantom
You can’t perform that action at this time.
0 commit comments