import { curry , Predicate } from '@typed/lambda' ; import { Just , Maybe , Nothing } from '@typed/maybe' ; export const findIndex = curry ( __findIndex ) ; function __findIndex < A > ( predicate , iterable ) { let i = 0 ; for ( const value of iterable ) { if ( predicate ( value ) ) { return Just . of ( i ) ; } i ++ ; } return Nothing ; }