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
7
7
Breaking changes:
8
8
9
9
New features:
10
+ - Add Semigroup and Monoid instances (#51 by @PureFunctor )
10
11
11
12
Bugfixes:
12
13
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module Control.Monad.ST.Internal
15
15
16
16
import Prelude
17
17
18
+ import Control.Apply (lift2 )
18
19
import Control.Monad.Rec.Class (class MonadRec , Step (..))
19
20
import Partial.Unsafe (unsafePartial )
20
21
@@ -72,6 +73,12 @@ instance monadRecST :: MonadRec (ST r) where
72
73
Loop _ -> true
73
74
_ -> false
74
75
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
+
75
82
-- | Run an `ST` computation.
76
83
-- |
77
84
-- | 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