HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleoptics-core-0.4.2Haskell2010

Optics.IxSetter

An IxSetter is an indexed version of a Setter. See the "Indexed optics" section of the overview documentation in the Optics module of the main optics package for more details on indexed optics.

Contents
  1. Formation
  2. Introduction
  3. Elimination
  4. Computation
  5. Well-formedness
  6. Additional introduction forms
  7. Additional elimination forms
  8. Subtyping
  9. Re-exports
Synopsis
  • Packageoptics-core-0.4.2
  • Exports10
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIxSetter.hs

Formation

Introduction

valueisets :: ((i -> a -> b) -> s -> t) -> IxSetter i s t a b

Build an indexed setter from a function to modify the element(s).

Elimination

Computation

iover (isets f) ≡ f

Well-formedness

  • PutPut: Setting twice is the same as setting once:

    Optics.Setter.iset l v' (Optics.Setter.iset l v s) ≡ Optics.Setter.iset l v' s
    
  • Functoriality: IxSetters must preserve identities and composition:

    iover s (const id) ≡ id
    iover s f . iover s g ≡ iover s (i -> f i . g i)
    

Additional introduction forms

Additional elimination forms

Subtyping

datadata A_Setter

Tag for a setter.

Instances17Is, JoinKinds, IxOptic, …

Re-exports

classclass Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i where

A Functor with an additional index.

Instances must satisfy a modified form of the Functor laws:

imap f . imap g ≡ imap (\i -> f i . g i)
imap (\_ a -> a) ≡ id

Methods

  • imap :: (i -> a -> b) -> f a -> f b

    Map with access to the index.

Instances30FunctorWithIndex, …