import { Arity2 , curry2 } from '@typed/functions' ; import { Index , List } from '../types' ; import { flatten } from '../flatten' ; import { map } from '../map' ; export const chain = curry2 ( __chain ) ; export type ListChain = { < A , B > ( f , list ) : Array < B > ; < A , B > ( f ) : ( list : List < A > ) => Array < B > ; } ; function __chain < A , B > ( f , list ) { return flatten < B > ( map ( f , list ) ) ; }