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

Add Either docs #324

Merged
merged 7 commits into from
Oct 19, 2018
Merged

Add Either docs #324

merged 7 commits into from
Oct 19, 2018

Conversation

evilsoft
Copy link
Owner

@evilsoft evilsoft commented Oct 14, 2018

This or That?

image

This PR adds the Either docs as requested in this issue.
Nothing too fancy, Just the same ol' stuff as the other docs PRs.

EDIT: Although, I did sneak in a few documentation 💄 and 💅 as I found them.

@coveralls
Copy link

coveralls commented Oct 14, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling de9a947 on docs/Either into b548d13 on master.

Copy link
Collaborator

@HenriqueLimas HenriqueLimas left a comment

Choose a reason for hiding this comment

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

Just some comments, but really great PR 👍

or a function that returns an instance of `Either`. When passed the instance,
a transformed `Async` is returned. When passed an `Either` returning function,
a function will be returned that takes a given value and returns an `Async`.
signatures and will behave differently when passed either
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMHO there are to much either here 😄 , I think we can remove the "when passed either" here


Like most other types in `crocks`, `Either` has a right bias in regard to
instance methods like `map`, `ap` and `chain`. This behavior can be used to
formally capture Error handling as the `Left` value will be maintained and most
Copy link
Collaborator

Choose a reason for hiding this comment

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

The most here is a little confusing. Is it most of the future or most important or maybe I misunderstood 😄. Maybe we could remove it.

`false` portion of a disjunction. The `Left` constructor takes a value of any
type and returns a `Left` instance wrapping the value passed to the constructor.

When an instance is a `Left`, most other methods `Either` returning methods on
Copy link
Collaborator

Choose a reason for hiding this comment

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

most other methods Either returning methods I think should be other Either returning methods

accomplished with `chain`. `chain` expects a unary, `Either` returning function
as its argument. When invoked on a `Left`, `chain` will not run the function,
but will instead return another `Left` wrapping the original value. When called
on a `Left` however, the inner value will be passed to provided function,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe: "the inner value will be passed to the provided function"

```

Used as a means to map and extract a value from an `Either` based on the
context. `either` takes two functions as its arguments. The first will map any
Copy link
Collaborator

Choose a reason for hiding this comment

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

comma instead of point after context maybe? Just to maintain the same style of the other ones.

the [`First`][first].

The [`First`][first] datatype is based on a [`Maybe`][maybe] and as such its
is fixed to a `()` type. As a means to allow for convenient
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we add here (unit) after (), the same we did before.

original non-empty.

The [`Last`][last] datatype is based on a [`Maybe`][maybe] and as such its left
or empty value is fixed to a `()` type. As a means to allow for convenient
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add (unit) here too after ()?

@evilsoft
Copy link
Owner Author

@HenriqueLimas addressed.

Copy link
Collaborator

@dalefrancis88 dalefrancis88 left a comment

Choose a reason for hiding this comment

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

looks good. Thanks for being so diligent on documentation

image

@dalefrancis88 dalefrancis88 merged commit a8e4859 into master Oct 19, 2018
@dalefrancis88 dalefrancis88 deleted the docs/Either branch October 19, 2018 21:56
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.

None yet

4 participants