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 READMEs for All, Any and Arrow types #148

Merged
merged 3 commits into from
Nov 8, 2017
Merged

Add READMEs for All, Any and Arrow types #148

merged 3 commits into from
Nov 8, 2017

Conversation

evilsoft
Copy link
Owner

@evilsoft evilsoft commented Nov 4, 2017

Seems like an OKAY start

image

These are the first in a series of Readmes to be added. This is another step in the Quest for monorepo.

Both All and Any did not require any API changes, while there was no need to keep value for Arrow as it no longer is used as a "traditional" Monoid as it was before Category was a thing.

This is a BREAKING API change. No depreciation, just dropping it.

@coveralls
Copy link

coveralls commented Nov 4, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 26ae7a1 on readmes into 0662911 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 26ae7a1 on readmes into 0662911 on master.

Copy link
Owner Author

@evilsoft evilsoft left a comment

Choose a reason for hiding this comment

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

I do not like these docs.
The examples are overly complicated and the focus is lost for almost all of them on Arrow
Dial back and only show maybe some law validation (without mentioning it, just to show what is expected for a given algebra on a given type.

`concat` is used to combine (2) `Semigroup`s of the same type under an operation specified by the `Semigroup`. In the case of `All`, it will combine the two using logical AND (conjunction).

```js
All(true).concat(All(true)) //=> All false
Copy link
Owner Author

Choose a reason for hiding this comment

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

This should result to All true

All(false).concat(All(false)) //=> All false
```

### value
Copy link
Owner Author

Choose a reason for hiding this comment

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

might as well name these to valueOf
due to: this PR


`empty` provides the identity for the `Monoid` in that when the value it provides is `concat`ed to any other value, it will return the other value. In the case of `Any` the result of `empty` is `false`. `empty` is available on both the Constructor and the Instance for convenience.
```js
Any.empty() //=> Any true
Copy link
Owner Author

Choose a reason for hiding this comment

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

should be Any false

isSameType(Any, Any) //=> true
isSameType(Any(false), Assign) //=> false

//=> false
Copy link
Owner Author

Choose a reason for hiding this comment

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

move under

Any(false).concat(Any(false)) //=> Any false
```

### value
Copy link
Owner Author

Choose a reason for hiding this comment

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

might as well name these to valueOf
due to: this PR

.runWith({ value: '23' }) //=> 10

arrAdd10Value
.runWith({ num: '23' }) //=> 10
Copy link
Owner Author

Choose a reason for hiding this comment

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

move under

Arrow(x => x.toUpperCase())

arrToUpper
.runWith('burrito bounce') //=> 'BURRITO BOUNCE'
Copy link
Owner Author

Choose a reason for hiding this comment

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

move under

Arrow a b ~> ((c -> a), (b -> d)) -> Arrow c d
```

`promap` can be used to adapt BOTH ends of an `Arrow` allow for existing `Arrow`s
Copy link
Owner Author

Choose a reason for hiding this comment

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

allowing for existing Arrows

```

`promap` can be used to adapt BOTH ends of an `Arrow` allow for existing `Arrow`s
to be reused in places in a flow where the types so not line up. It combines both
Copy link
Owner Author

Choose a reason for hiding this comment

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

do not line up

const arrDoubleAndAdd =
arrDouble
.both()
.map(merge((x, y) => x + y))
Copy link
Owner Author

Choose a reason for hiding this comment

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

use the add function here.

@coveralls
Copy link

coveralls commented Nov 8, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 1a63708 on readmes into 0662911 on master.

@evilsoft
Copy link
Owner Author

evilsoft commented Nov 8, 2017

image

Actually I am okay with these examples. They are not so bad.
Merging.

@evilsoft evilsoft merged commit 8aeb07f into master Nov 8, 2017
@evilsoft evilsoft deleted the readmes branch November 8, 2017 02:43
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.

2 participants