HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleoptics-core-0.4.2Haskell2010

Optics.IxAffineTraversal

An IxAffineTraversal is an indexed version of an AffineTraversal. 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. Combinators
  5. Additional introduction forms
  6. Monoid structure
  7. Subtyping
  8. van Laarhoven encoding
Synopsis
  • Packageoptics-core-0.4.2
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIxAffineTraversal.hs

Formation

Introduction

Elimination

An IxAffineTraversal is in particular an IxAffineFold and an IxSetter, therefore you can specialise types to obtain:

ipreview :: IxAffineTraversal i s t a b -> s -> Maybe (i, a)
iover    :: IxAffineTraversal i s t a b -> (i -> a -> b) -> s -> t
iset     :: IxAffineTraversal i s t a b -> (i      -> b) -> s -> t

Combinators

Additional introduction forms

Monoid structure

IxAffineTraversal admits a monoid structure where iadisjoin returns the result from the second indexed affine traversal only if the first does not return a result. The identity element is ignored (which traverses no elements).

Subtyping

Tag for an affine traversal.

Instances31Is, ArrowOptic, JoinKinds, IxOptic, ToReadOnly, GenericOptic, …

van Laarhoven encoding

typetype IxAffineTraversalVL i s t a b = forall (f :: Type -> Type). Functor f => (forall r. r -> f r) -> (i -> a -> f b) -> s -> f t

Type synonym for a type-modifying van Laarhoven indexed affine traversal.

Note: this isn't exactly van Laarhoven representation as there is no Pointed class (which would be a superclass of Applicative that contains pure but not <*>). You can interpret the first argument as a dictionary of Pointed that supplies the point function (i.e. the implementation of pure).