import { Either , isLeft } from './Either' ; import { curry2 } from '@typed/functions' ; import { fromLeft } from './Left' ; name export const chainLeft = curry2 ( __chainLeft ) ; function __chainLeft < A , B , C > ( f , either ) { return isLeft ( either ) ? f ( fromLeft ( either ) ) : either ; } export type EitherChainLeft = { < A , B , C > ( f , either ) : Either < C , B > ; < A , B , C > ( f ) : ( either : Either < A , B > ) => Either < C , B > ; } ;