lens-5.3.5: Lenses, Folds and Traversals

Copyright | (C) 2012-16 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | MPTCs, Rank2Types, LiberalTypeSynonyms
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Array.Lens

Contents

- Setters

Description

Synopsis

- ixmapped :: forall (a :: Type -> Type -> Type) e i j. (IArray a e, Ix i, Ix j) => (i, i) -> IndexPreservingSetter (a j e) (a i e) i j

# Setters

ixmapped :: forall (a :: Type -> Type -> Type) e i j. (IArray a e, Ix i, Ix j) => (i, i) -> IndexPreservingSetter (a j e) (a i e) i j Source #

This `Setter` can be used to derive a new `IArray` from an old `IArray` by applying a function to each of the indices to look it up in the old `IArray`.

This is a contravariant `Setter`.

    ixmap ≡ over . ixmapped
    ixmapped ≡ setting . ixmap
    over (ixmapped b) f arr ! i ≡ arr ! f i
    bounds (over (ixmapped b) f arr) ≡ b