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

Nomenclature for the SemigroupK hierarchy #4329

Merged
merged 2 commits into from
Dec 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/nomenclature.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,36 @@ Like the previous section, we use the `E` for the error parameter type.
| `F[A] => ((A,Int) => B) => F[B]` | `mapWithIndex` |
| `F[A] => ((A,Int) => G[B]) => G[F[B]]` | `traverseWithIndex` | `F: Monad`

### SemigroupK
| Type | Method Name | Constraints |
|------------|--------------|-----------|
| `F[A] => F[A] => F[A]`| `combineK` |
| `F[A] => Int => F[A]` | `combineNK`
| `F[A] => F[B] => F[Either[A, B]]` | `sum` | `F: Functor`
| `IterableOnce[F[A]] => Option[F[A]]` | `combineAllOptionK`

### MonoidK
| Type | Method Name | Constraints |
|------------|--------------|-----------|
| `F[A]` | `empty`
| `F[A] => Boolean` | `isEmpty`
| `IterableOnce[F[A]] => F[A]` | `combineAllK`

### Alternative
Copy link
Contributor

@satorg satorg Oct 28, 2022

Choose a reason for hiding this comment

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

Honestly, I've never put attention to this page and thus I've just realized it exists! 😊
Would you consider to mention about NonEmptyAlternative there as well?

Type Method Name Constraints
A => F[A] => F[A] prependK
F[A] => A => F[A] appendK

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yeah sure!

Copy link
Member Author

Choose a reason for hiding this comment

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

And yes, I only just discovered it and it's ridiculously useful! 😆

| Type | Method Name | Constraints |
|------------|--------------|-----------|
| `F[G[A]] => F[A]` | `unite` | `F: FlatMap` and `G: Foldable`
| `F[G[A, B]] => (F[A], F[B])` | `separate` | `F: FlatMap` and `G: Bifoldable`
| `F[G[A, B]] => (F[A], F[B])` | `separateFoldable` | `F: Foldable` and `G: Bifoldable`
| `Boolean => F[Unit]` | `guard`
| `IterableOnce[A] => F[A]` | `fromIterableOnce`
| `G[A] => F[A]` | `fromFoldable` | `G: Foldable`

### NonEmptyAlternative
| Type | Method Name | Constraints |
|------------|--------------|-----------|
| `A => F[A] => F[A]` | `prependK`
| `F[A] => A => F[A]` | `appendK`

## Transformers

Expand Down