You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose adding direct support for constructing a Writer from a log, and ensuring that there are syntactically similar equivalents for creating from a log, a result, and a log and a result together.
There's currently support for creating Writers using the pure syntax and the Writer.apply method. However, any other constructors require you to know about WriterT.
One possibility would be to add a tell syntax like the one in Scalaz:
Another possibility would be adding Writer.tell and Writer.put / Writer.value to mirror the constructors on WriterT.
I realise this is duplicating functionality that's already there with WriterT, but I think there's a cleaner learning curve if people can learn about Reader, Writer, and State before they jump into monad transformers.
Keen to know peoples' thoughts!
The text was updated successfully, but these errors were encountered:
The former is a direct port from Scalaz. The latter is like the set syntax un Scalaz, but renamed for clarity. Combined with pure, this would provide comprehensive syntax for creating Writers.
The syntax would go in cats.syntax.writer, be included in cats.syntax.all, and have tests in WriterSpec.
I'd like to propose adding direct support for constructing a
Writer
from a log, and ensuring that there are syntactically similar equivalents for creating from a log, a result, and a log and a result together.There's currently support for creating
Writers
using thepure
syntax and theWriter.apply
method. However, any other constructors require you to know aboutWriterT
.One possibility would be to add a
tell
syntax like the one in Scalaz:This would give us
pure
andtell
to create from a result or a log, andWriter.apply
to create from both values together.One could also add an equivalent of Scalaz'
set
syntax, although IMO the name would have to change:Another possibility would be adding
Writer.tell
andWriter.put
/Writer.value
to mirror the constructors onWriterT
.I realise this is duplicating functionality that's already there with
WriterT
, but I think there's a cleaner learning curve if people can learn aboutReader
,Writer
, andState
before they jump into monad transformers.Keen to know peoples' thoughts!
The text was updated successfully, but these errors were encountered: