Skip to content

Commit 91c84c7

Browse files
authored
Merge pull request #98 from purescript/writer
Add the `writer` function
2 parents b5cc7d6 + 5ad3b7b commit 91c84c7

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)