import { Arity1 , curry2 } from '@typed/functions' ; import { Either } from '@typed/either' ; import { List } from '@typed/list' ; import { Maybe } from '@typed/maybe' ; import { chain } from './chain' ; import { map } from './map' ; name export const ap = curry2 ( __ap ) ; function __ap < A , B > ( fn , value ) { return chain ( ( f ) => map ( f , value ) , fn ) ; } export type Ap = { < A , B > ( fn , list ) : Array < B > ; < A , B > ( fn , maybe ) : Maybe < B > ; < A , B > ( fn , promise ) : Promise < B > ; < A , B , C > ( fn , either ) : Either < A , C > ; < A , B > ( fn ) : ( list : List < A > ) => Array < B > ; < A , B > ( fn ) : ( maybe : Maybe < A > ) => Maybe < B > ; < A , B > ( fn ) : ( promise : PromiseLike < A > ) => Promise < B > ; < A , B , C > ( fn ) : ( either : Either < A , B > ) => Either < A , C > ; } ;