since import { Index , Optional } from '..' ; import { NonEmptyArray , updateAt } from 'fp-ts/lib/NonEmptyArray' ; import { lookup } from 'fp-ts/lib/Array' ; import { isNone } from 'fp-ts/lib/Option' ; category since export function indexNonEmptyArray < A = never > ( ) { return new Index ( ( i ) => new Optional ( ( s ) => lookup ( i , s ) , ( a ) => ( nea ) => { const onea = updateAt ( i , a ) ( nea ) ; if ( isNone ( onea ) ) { return nea ; } else { return onea . value ; } } ) ) ; }