HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleoptics-core-0.4.1.1Haskell2010

Optics.Internal.Indexed

Internal implementation details of indexed optics.

This module is intended for internal use only, and may change without warning in subsequent releases.

  • 2 types
  • 3 classes
  • 3 values
classclass NonEmptyIndices (is :: IxList)
#

Check whether a list of indices is not empty and generate sensible error message if it's not.

Instances2NonEmptyIndices
classclass is ~ '[i] => HasSingleIndex (is :: IxList) i
#

Generate sensible error messages in case a user tries to pass either an unindexed optic or indexed optic with unflattened indices where indexed optic with a single index is expected.

Instances7HasSingleIndex, …
  • (TypeError ('Text "Indexed optic is expected"), '[] ~ '[i]) => HasSingleIndex '[] iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
  • HasSingleIndex '[i] iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
  • (TypeError ('Text "Use (<%>) or icompose to combine indices of type " ':<>: ShowTypes is), is ~ '[i1, i2], is ~ '[i]) => HasSingleIndex '[i1, i2] iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
  • (TypeError ('Text "Use icompose3 to combine indices of type " ':<>: ShowTypes is), is ~ '[i1, i2, i3], is ~ '[i]) => HasSingleIndex '[i1, i2, i3] iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
  • (TypeError ('Text "Use icompose4 to combine indices of type " ':<>: ShowTypes is), is ~ '[i1, i2, i3, i4], is ~ '[i]) => HasSingleIndex '[i1, i2, i3, i4] iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
  • (TypeError ('Text "Use icompose5 to flatten indices of type " ':<>: ShowTypes is), is ~ '[i1, i2, i3, i4, i5], is ~ '[i]) => HasSingleIndex '[i1, i2, i3, i4, i5] iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
  • (TypeError ('Text "Use icomposeN to flatten indices of type " ':<>: ShowTypes is), is ~ (i1 ': i2 ': i3 ': i4 ': i5 ': i6 ': is'), is ~ '[i]) => HasSingleIndex (i1 ': i2 ': i3 ': i4 ': i5 ': i6 ': is') iDefined in optics-core-0.4.1.1 · Optics.Internal.Indexed
valueindexing
  1. :: (a -> Indexing f b) -> s -> Indexing f t
  2. -> Int -> a -> f b
  3. -> s
  4. -> f t
#

Index a traversal by position of visited elements.

valueconjoined
  1. :: HasSingleIndex is i
  2. => Optic k NoIx s t a b
  3. -> Optic k is s t a b
  4. -> Optic k is s t a b
#

Construct a conjoined indexed optic that provides a separate code path when used without indices. Useful for defining indexed optics that are as efficient as their unindexed equivalents when used without indices.

Note: conjoined f g is well-defined if and only if f ≡ noIx g.