module import compose from '../../compose' ; import ternary from '../../ternary' ; import type { Either } from '../either' ; import type { Map } from '../../types/map' ; import permutation3 from '../../permutation/permutation-3' ; import { isLeft } from './guards' ; import { bifoldl , bifoldr } from './bifold' ; /**
 * Maps left and right values of the provided `monad` to a value,
 * then returns it.
 */ export default function bifoldMap < LeftValue , RightValue , MappedValue > ( mapLeft , mapRight ) ; /**
 * Maps left and right values of the provided `monad` to a value,
 * then returns it.
 */ export default function bifoldMap < LeftValue , RightValue , MappedValue > ( monad , mapLeft , mapRight ) ; export default function bifoldMap ( ... args ) { return permutation3 ( < LeftValue , RightValue , MappedValue > ( monad , mapLeft , mapRight ) : MappedValue => { return ternary ( isLeft , compose ( mapLeft , bifoldl ) , compose ( mapRight , bifoldr ) ) ( monad ) ; } ) ( ... args ) ; }