Skip to content

Commit 5ad3b7b

Browse files
committed
Add the writer function
1 parent b5cc7d6 commit 5ad3b7b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Control/Monad/Writer.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import Data.Tuple (Tuple, snd)
2222
-- | to the `Identity` monad.
2323
type Writer w = WriterT w Identity
2424

25+
-- | Creates a `Writer` from a result and output pair.
26+
writer :: forall w a. Tuple a w -> Writer w a
27+
writer = WriterT <<< pure
28+
2529
-- | Run a computation in the `Writer` monad
2630
runWriter :: forall w a. Writer w a -> Tuple a w
2731
runWriter = unwrap <<< runWriterT

0 commit comments

Comments
 (0)