Skip to content
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

Merged
merged 17 commits into from
Oct 12, 2020

Conversation

benkio
Copy link
Contributor

@benkio benkio commented Sep 28, 2020

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

@benkio benkio mentioned this pull request Sep 28, 2020
70 tasks
@codecov-commenter
Copy link

Codecov Report

Merging #3618 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

@@            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     

Copy link
Contributor

@larsrh larsrh left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Into the [Writer
In the [Writer


## Example

As en example, we can consider a simple naive console application that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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-io
Copy link

Codecov Report

Merging #3618 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

@@            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-commenter
Copy link

Codecov Report

Merging #3618 into master will decrease coverage by 1.04%.
The diff coverage is n/a.

@@            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-io
Copy link

Codecov Report

Merging #3618 into master will decrease coverage by 1.04%.
The diff coverage is n/a.

@@            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     

@benkio
Copy link
Contributor Author

benkio commented Oct 10, 2020

Thanks a lot for this! I have only a few minor comments and suggestions.

Comments addressed 👍 Thank you

Copy link
Member

@LukaJCB LukaJCB left a 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!

@LukaJCB LukaJCB merged commit 3c31377 into typelevel:master Oct 12, 2020
@benkio benkio deleted the Writer_WriterT_documentation_625 branch October 12, 2020 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WriterT documentation
6 participants