Skip to content

Commit

Permalink
Docs: add getDualSemigroup / getDualMonoid documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed May 5, 2020
1 parent 5a18b7a commit 17aa4af
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/modules/Monoid.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,22 @@ Added in v2.0.0

# getDualMonoid

The dual of a `Monoid`, obtained by swapping the arguments of `concat`.

**Signature**

```ts
export declare function getDualMonoid<A>(M: Monoid<A>): Monoid<A>
```

**Example**

```ts
import { getDualMonoid, monoidString } from 'fp-ts/lib/Monoid'
assert.deepStrictEqual(getDualMonoid(monoidString).concat('a', 'b'), 'ba')
```

Added in v2.0.0

# getEndomorphismMonoid
Expand Down
10 changes: 10 additions & 0 deletions docs/modules/Semigroup.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,22 @@ Added in v2.0.0

# getDualSemigroup

The dual of a `Semigroup`, obtained by swapping the arguments of `concat`.

**Signature**

```ts
export declare function getDualSemigroup<A>(S: Semigroup<A>): Semigroup<A>
```

**Example**

```ts
import { getDualSemigroup, semigroupString } from 'fp-ts/lib/Semigroup'
assert.deepStrictEqual(getDualSemigroup(semigroupString).concat('a', 'b'), 'ba')
```

Added in v2.0.0

# getFirstSemigroup
Expand Down
7 changes: 7 additions & 0 deletions src/Monoid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ export function getTupleMonoid<T extends ReadonlyArray<Monoid<any>>>(
}

/**
* The dual of a `Monoid`, obtained by swapping the arguments of `concat`.
*
* @example
* import { getDualMonoid, monoidString } from 'fp-ts/lib/Monoid'
*
* assert.deepStrictEqual(getDualMonoid(monoidString).concat('a', 'b'), 'ba')
*
* @since 2.0.0
*/
export function getDualMonoid<A>(M: Monoid<A>): Monoid<A> {
Expand Down
7 changes: 7 additions & 0 deletions src/Semigroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export function getTupleSemigroup<T extends ReadonlyArray<Semigroup<any>>>(
}

/**
* The dual of a `Semigroup`, obtained by swapping the arguments of `concat`.
*
* @example
* import { getDualSemigroup, semigroupString } from 'fp-ts/lib/Semigroup'
*
* assert.deepStrictEqual(getDualSemigroup(semigroupString).concat('a', 'b'), 'ba')
*
* @since 2.0.0
*/
export function getDualSemigroup<A>(S: Semigroup<A>): Semigroup<A> {
Expand Down

0 comments on commit 17aa4af

Please sign in to comment.