Skip to content

Commit 2c45993

Browse files
committed
Drop unnecessary Monad instance for Apply
1 parent ac33773 commit 2c45993

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

docs/Module.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,9 @@
667667

668668
### Values
669669

670-
evalStateT :: forall s m a. (Monad m) => StateT s m a -> s -> m a
670+
evalStateT :: forall s m a. (Apply m) => StateT s m a -> s -> m a
671671

672-
execStateT :: forall s m a. (Monad m) => StateT s m a -> s -> m s
672+
execStateT :: forall s m a. (Apply m) => StateT s m a -> s -> m s
673673

674674
liftCallCCState :: forall s m a b. (((Tuple a s -> m (Tuple b s)) -> m (Tuple a s)) -> m (Tuple a s)) -> ((a -> StateT s m b) -> StateT s m a) -> StateT s m a
675675

@@ -779,7 +779,7 @@
779779

780780
### Values
781781

782-
execWriterT :: forall w m a. (Monad m) => WriterT w m a -> m w
782+
execWriterT :: forall w m a. (Apply m) => WriterT w m a -> m w
783783

784784
liftCallCCWriter :: forall w m a b. (Monoid w) => (((Tuple a w -> m (Tuple b w)) -> m (Tuple a w)) -> m (Tuple a w)) -> ((a -> WriterT w m b) -> WriterT w m a) -> WriterT w m a
785785

src/Control/Monad/State/Trans.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ newtype StateT s m a = StateT (s -> m (Tuple a s))
1313
runStateT :: forall s m a. StateT s m a -> s -> m (Tuple a s)
1414
runStateT (StateT s) = s
1515

16-
evalStateT :: forall s m a. (Monad m) => StateT s m a -> s -> m a
17-
evalStateT m s = runStateT m s >>= \(Tuple x _) -> return x
16+
evalStateT :: forall s m a. (Apply m) => StateT s m a -> s -> m a
17+
evalStateT m s = fst <$> runStateT m s
1818

19-
execStateT :: forall s m a. (Monad m) => StateT s m a -> s -> m s
20-
execStateT m s = runStateT m s >>= \(Tuple _ s) -> return s
19+
execStateT :: forall s m a. (Apply m) => StateT s m a -> s -> m s
20+
execStateT m s = snd <$> runStateT m s
2121

2222
mapStateT :: forall s m1 m2 a b. (m1 (Tuple a s) -> m2 (Tuple b s)) -> StateT s m1 a -> StateT s m2 b
2323
mapStateT f m = StateT $ f <<< runStateT m

src/Control/Monad/Writer/Trans.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ newtype WriterT w m a = WriterT (m (Tuple a w))
1313
runWriterT :: forall w m a. WriterT w m a -> m (Tuple a w)
1414
runWriterT (WriterT x) = x
1515

16-
execWriterT :: forall w m a. (Monad m) => WriterT w m a -> m w
17-
execWriterT m = runWriterT m >>= \(Tuple _ w) -> return w
16+
execWriterT :: forall w m a. (Apply m) => WriterT w m a -> m w
17+
execWriterT m = snd <$> runWriterT m
1818

1919
mapWriterT :: forall w1 w2 m1 m2 a b. (m1 (Tuple a w1) -> m2 (Tuple b w2)) -> WriterT w1 m1 a -> WriterT w2 m2 b
2020
mapWriterT f m = WriterT $ f (runWriterT m)

0 commit comments

Comments
 (0)