module import { isLeft } from '../guards' ; import ternary from '../../../ternary' ; import type { Either } from '../../either' ; import type { Map } from '../../../types/map' ; import permutation3 from '../../../permutation/permutation-3' ; import first from './first' ; import second from './second' ; /**
 * Maps left and right values of the provided `monad` to a new `Either` monad.
 */ export default function bimap < LeftValue , RightValue , NextLeftValue , NextRightValue > ( mapLeft , mapRight ) ; /**
 * Maps left and right values of the provided `monad` to a new `Either` monad.
 */ export default function bimap < LeftValue , RightValue , NextLeftValue , NextRightValue > ( monad , mapLeft , mapRight ) ; export default function bimap ( ... args ) { return permutation3 ( < LeftValue , RightValue , NextLeftValue , NextRightValue > ( monad , mapLeft , mapRight ) : Either < NextLeftValue , NextRightValue > => { return ternary ( isLeft , first ( mapLeft ) as Map < typeof monad , Either < NextLeftValue , NextRightValue > > , second ( mapRight ) as Map < typeof monad , Either < NextLeftValue , NextRightValue > > ) ( monad ) ; } ) ( ... args ) ; }