import { curry } from '@typed/lambda'
import { chain } from './chain'
import { Either } from './Either'
/**
* Returns a `Either` that is the result of calling `f` with the resolved
* value of another `Either`.
* @name map(f: (value: B) => C, either: Either): Either
*/
export const map = curry(__map) as {
(f: (value: B) => C, either: Either): Either
(f: (value: B) => C): (either: Either) => Either
}
function __map(f: (value: B) => C, either: Either): Either {
return chain((value) => Either.of(f(value)), either)
}