Skip to content

Commit

Permalink
add missing instances to Either.getValidation
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Feb 27, 2020
1 parent 8cd4a92 commit fc9f59b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
**Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a
high state of flux, you're at risk of it changing without notice.

# 2.5.2

- **Polish**
- `Either`
- add missing instances to `getValidation` (@gcanti)

# 2.5.1

- **New Feature**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fp-ts",
"version": "2.5.1",
"version": "2.5.2",
"description": "Functional programming in TypeScript",
"files": [
"lib",
Expand Down
20 changes: 13 additions & 7 deletions src/Either.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
import { Alt2, Alt2C } from './Alt'
import { Applicative } from './Applicative'
import { Bifunctor2 } from './Bifunctor'
import { ChainRec2, tailRec } from './ChainRec'
import { ChainRec2, tailRec, ChainRec2C } from './ChainRec'
import { Separated } from './Compactable'
import { Eq } from './Eq'
import { Extend2 } from './Extend'
import { Foldable2 } from './Foldable'
import { Lazy, Predicate } from './function'
import { HKT } from './HKT'
import { Monad2, Monad2C } from './Monad'
import { MonadThrow2 } from './MonadThrow'
import { MonadThrow2, MonadThrow2C } from './MonadThrow'
import { Monoid } from './Monoid'
import { Option } from './Option'
import { pipeable } from './pipeable'
Expand Down Expand Up @@ -476,12 +476,19 @@ export function getWitherable<E>(M: Monoid<E>): Witherable2C<URI, E> {
/**
* @since 2.0.0
*/
export function getValidation<E>(S: Semigroup<E>): Monad2C<URI, E> & Alt2C<URI, E> {
export function getValidation<E>(
S: Semigroup<E>
): Monad2C<URI, E> &
Foldable2<URI> &
Traversable2<URI> &
Bifunctor2<URI> &
Alt2C<URI, E> &
Extend2<URI> &
ChainRec2C<URI, E> &
MonadThrow2C<URI, E> {
return {
URI,
...either,
_E: undefined as any,
map: either.map,
of: either.of,
ap: (mab, ma) =>
isLeft(mab)
? isLeft(ma)
Expand All @@ -490,7 +497,6 @@ export function getValidation<E>(S: Semigroup<E>): Monad2C<URI, E> & Alt2C<URI,
: isLeft(ma)
? ma
: right(mab.right(ma.right)),
chain: either.chain,
alt: (fx, f) => {
if (isRight(fx)) {
return fx
Expand Down

0 comments on commit fc9f59b

Please sign in to comment.