Skip to content

Commit 5e0f904

Browse files
committed
Add execWriter
1 parent 3261806 commit 5e0f904

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Control/Monad/Writer.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ type Writer w a = WriterT w Identity a
1111
runWriter :: forall w a. Writer w a -> Tuple a w
1212
runWriter = runIdentity <<< runWriterT
1313

14+
execWriter :: forall w a. Writer w a -> w
15+
execWriter m = snd (runWriter m)
16+
1417
mapWriter :: forall w1 w2 a b. (Tuple a w1 -> Tuple b w2) -> Writer w1 a -> Writer w2 b
1518
mapWriter f = mapWriterT (Identity <<< f <<< runIdentity)

0 commit comments

Comments
 (0)