An effect capable of emitting and intercepting messages.
Modulepolysemy-1.9.2.0Haskell2010
Polysemy.Writer
Synopsis
- data Writer
- value tell
- value listen
- value pass
- value censor
- value runWriter
- value runLazyWriter
- value runWriterAssocR
- value runLazyWriterAssocR
- value runWriterTVar
- value writerToIOFinal
- value writerToIOAssocRFinal
- value writerToEndoWriter
- value outputToWriter
- Packagepolysemy-1.9.2.0
- Exports14
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceWriter.hs
Effect
Actions
Write a message to the log.
Return the log produced by the higher-order action.
Run the given action and apply the function it returns to the log.
Interpretations
Like runLazyWriter, but right-associates uses of <>.
This asymptotically improves performance if the time complexity of <> for the Monoid depends only on the size of the first argument.
You should always use this instead of runLazyWriter if the monoid is a list, such as String.
Warning: This inherits the nasty space leak issue of WriterT! Don't use this if you don't have to.
Run a Writer effect by transforming it into atomic operations through final IO.
Internally, this simply creates a new TVar, passes it to runWriterTVar, and then returns the result and the final value of the TVar.
Beware: Effects that aren't interpreted in terms of IO will have local state semantics in regards to Writer effects interpreted this way. See Final.
Like writerToIOFinal. but right-associates uses of <>.
This asymptotically improves performance if the time complexity of <> for the Monoid depends only on the size of the first argument.
You should always use this instead of writerToIOFinal if the monoid is a list, such as String.
Beware: Effects that aren't interpreted in terms of IO will have local state semantics in regards to Writer effects interpreted this way. See Final.