import { List } from '../types' ; import { UpdateArity3 } from './types' ; import { arrayFrom } from '../arrayFrom' ; import { curry3 } from '@typed/functions' ; name export const update = curry3 ( function update < A > ( index , value , list ) : Array < A > { const length = list . length ; const newList = arrayFrom ( list ) ; if ( length === 0 || index < 0 || index >= length ) return newList ; newList [ index ] = value ; return newList ; } ) ;