-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writer and WriterT documentation site pages #3618
Writer and WriterT documentation site pages #3618
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3618 +/- ##
==========================================
- Coverage 91.33% 91.27% -0.06%
==========================================
Files 386 380 -6
Lines 8628 8331 -297
Branches 260 225 -35
==========================================
- Hits 7880 7604 -276
+ Misses 748 727 -21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this! I have only a few minor comments and suggestions.
--- | ||
# Writer | ||
|
||
The `Writer[L, A]` datatype represents a computation that produce a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `Writer[L, A]` datatype represents a computation that produce a | |
The `Writer[L, A]` datatype represents a computation that produces a |
datatype. Meanwhile, the value `A` is the actual output of the | ||
computation. | ||
|
||
The main features the `Writer` provides are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main features the `Writer` provides are: | |
The main features that `Writer` provides are: |
- The flexibility regarding Log value management. It can be modified | ||
in multiple ways. See the [Operations section](#operations) | ||
- When two functions are composed together, eg using `flatMap`, the | ||
logs of both functions will be combined using an implicit [Semigroup](https://typelevel.org/cats/typeclasses/semigroup.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both are good points, but if it's an enumeration, the structure of the sentences should be similar. I suggest removing the bullet points and rephrasing it as a paragraph.
|
||
## Operations | ||
|
||
The `Writer` datatype provides a set of functions that are quite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"quite identical" → "similar to"
|
||
The `Writer` datatype provides a set of functions that are quite | ||
identical to the ones from the [Monad](https://typelevel.org/cats/typeclasses/monad.html) typeclass. In fact, they share | ||
the same name and the same signature, but for the requirement of a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same name and the same signature, but for the requirement of a | |
the same name and the same signature, but have an additional requirement of a |
## Composition | ||
|
||
`WriterT` can be more convenient to work with than using | ||
`F[Writer[L, V]]` directly, this because it exposes operations that allow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`F[Writer[L, V]]` directly, this because it exposes operations that allow | |
`F[Writer[L, V]]` directly, because it exposes operations that allow |
Just for completeness, we can have a look at the same example, but | ||
with | ||
[`Validated`](https://typelevel.org/cats/datatypes/validated.html) | ||
since it as a slightly different behaviour then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it as a slightly different behaviour then | |
since it as a slightly different behaviour than |
|
||
## Construct a WriterT | ||
|
||
A `WriterT` can be built starting from multiple values. Here is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A `WriterT` can be built starting from multiple values. Here is the | |
A `WriterT` can be constructed in different ways. Here is the |
|
||
## Operations | ||
|
||
Into the [Writer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Into the [Writer | |
In the [Writer |
|
||
## Example | ||
|
||
As en example, we can consider a simple naive console application that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As en example, we can consider a simple naive console application that | |
As an example, we can consider a simple naive console application that |
Codecov Report
@@ Coverage Diff @@
## master #3618 +/- ##
==========================================
- Coverage 91.33% 91.27% -0.06%
==========================================
Files 386 380 -6
Lines 8628 8331 -297
Branches 260 225 -35
==========================================
- Hits 7880 7604 -276
+ Misses 748 727 -21 |
Codecov Report
@@ Coverage Diff @@
## master #3618 +/- ##
==========================================
- Coverage 91.33% 90.28% -1.05%
==========================================
Files 386 391 +5
Lines 8628 8872 +244
Branches 260 262 +2
==========================================
+ Hits 7880 8010 +130
- Misses 748 862 +114 |
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #3618 +/- ##
==========================================
- Coverage 91.33% 90.28% -1.05%
==========================================
Files 386 391 +5
Lines 8628 8872 +244
Branches 260 262 +2
==========================================
+ Hits 7880 8010 +130
- Misses 748 862 +114 |
Comments addressed 👍 Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for working on this!
Fix #625
Please be patient, I'm a non native english speaker. Basically the less qualified man for the job. Any feedback appreciated and I'll fix it ASAP