import { Index , List } from '../types' ; import { Maybe , map } from '@typed/maybe' ; import { curry2 } from '@typed/functions' ; import { findIndex } from '../findIndex' ; name export const find = curry2 ( __find ) as Find ; export type Find = { < A > ( predicate , list ) : Maybe < Readonly < A > > ; ( predicate ) : < A > ( list : List < A > ) => Maybe < Readonly < A > > ; } ; const prop = < A > ( list ) => ( index ) : A => list [ index ] ; function __find < A > ( predicate , list ) { return map ( prop ( list ) , findIndex ( predicate , list ) ) ; }