moy-fp
Version:
A functional programming library.
15 lines (12 loc) • 308 B
JavaScript
import curry from '../Function/curry'
import nthList from '../List/nthList'
import update from '../List/update'
import lens from './lens'
/**
* Number -> Lens s a
* Lens s a = Functor f => (a -> f a) -> s -> f s
*/
const lensIndex = curry(
n => lens(nthList(n))(update(n))
)
export default lensIndex