import { modifyAt } from 'fp-ts/lib/Array' ; import { Endomorphism } from 'fp-ts/lib/function' ; import { getOrElse } from 'fp-ts/lib/Option' ; import { pipe } from 'fp-ts/lib/pipeable' ; function _adjust < A > ( i , f , as ) { return pipe ( modifyAt ( i >= 0 ? i : as . length + i , f ) ( as ) , getOrElse ( ( ) => as ) ) ; } since export function adjust ( i ) ; export function adjust < A > ( i , f ) ; export function adjust < A > ( i , f , as ) ; export function adjust < A > ( i , f ? , as ? ) { if ( f === undefined ) { return ( f , as ? ) => { if ( as === undefined ) { return ( as ) => _adjust ( i , f , as ) ; } else { return _adjust ( i , f , as ) ; } } ; } else if ( as === undefined ) { return ( as ) => _adjust ( i , f , as ) ; } else { return _adjust ( i , f , as ) ; } }