HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleoptics-core-0.4.1.1Haskell2010

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.

  • 3 types
  • 1 class
  • 6 values

Formation

2 declarations

Introduction

1 declaration
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

1 declaration

Computation

0 declarations
iover (isets f) ≡ f

Well-formedness

0 declarations
  • 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

1 declaration

Additional elimination forms

3 declarations

Subtyping

1 declaration
datadata A_Setter
#

Tag for a setter.

Instances17Is, JoinKinds, IxOptic, …

Re-exports

1 declaration
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, …