Skip to content

Commit

Permalink
improve getIOValidation
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Dec 7, 2019
1 parent e574c65 commit 45b126b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion docs/modules/IOEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ Added in v2.1.0
**Signature**
```ts
export function getIOValidation<E>(S: Semigroup<E>): Monad2C<URI, E> & Alt2C<URI, E> { ... }
export function getIOValidation<E>(
S: Semigroup<E>
): Monad2C<URI, E> & Bifunctor2C<URI, E> & Alt2C<URI, E> & MonadIO2C<URI, E> & MonadThrow2C<URI, E> { ... }
```
Added in v2.0.0
Expand Down
16 changes: 11 additions & 5 deletions src/IOEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* error of type `E`. If you want to represent a synchronous computation that never fails, please see `IO`.
*/
import { Alt2, Alt2C } from './Alt'
import { Bifunctor2 } from './Bifunctor'
import { Bifunctor2, Bifunctor2C } from './Bifunctor'
import * as E from './Either'
import { getEitherM } from './EitherT'
import { Filterable2C, getFilterableComposition } from './Filterable'
import { Lazy } from './function'
import { getSemigroup as getIOSemigroup, IO, io } from './IO'
import { Monad2, Monad2C } from './Monad'
import { MonadIO2 } from './MonadIO'
import { MonadThrow2 } from './MonadThrow'
import { MonadIO2, MonadIO2C } from './MonadIO'
import { MonadThrow2, MonadThrow2C } from './MonadThrow'
import { Monoid } from './Monoid'
import { pipeable } from './pipeable'
import { Semigroup } from './Semigroup'
import { getValidationM } from './ValidationT'
import { Filterable2C, getFilterableComposition } from './Filterable'

import Either = E.Either

Expand Down Expand Up @@ -142,11 +142,17 @@ export function bracket<E, A, B>(
/**
* @since 2.0.0
*/
export function getIOValidation<E>(S: Semigroup<E>): Monad2C<URI, E> & Alt2C<URI, E> {
export function getIOValidation<E>(
S: Semigroup<E>
): Monad2C<URI, E> & Bifunctor2C<URI, E> & Alt2C<URI, E> & MonadIO2C<URI, E> & MonadThrow2C<URI, E> {
const T = getValidationM(S, io)
return {
URI,
_E: undefined as any,
throwError: ioEither.throwError,
bimap: ioEither.bimap,
mapLeft: ioEither.mapLeft,
fromIO: ioEither.fromIO,
...T
}
}
Expand Down

0 comments on commit 45b126b

Please sign in to comment.