import { Filter } from './types' ; import { List } from '../types' ; import { curry2 } from '@typed/functions' ; name export const filter = curry2 ( function filter < A > ( predicate , list ) : Array < A > { const length = list . length ; const newList = [ ] ; for ( let i = 0 ; i < length ; ++ i ) if ( predicate ( list [ i ] , i ) ) newList . push ( list [ i ] ) ; return newList ; } ) ;