optics-core

Optics as an abstract interface: core definitions

Version on this page:0.4.1.1
LTS Haskell 24.24:0.4.1.1@rev:1
Stackage Nightly 2025-12-16:0.4.1.1@rev:1
Latest on Hackage:0.4.1.1@rev:1

See all snapshots optics-core appears in

BSD-3-Clause licensed by Adam Gundry, Andres Löh, Andrzej Rybczak, Oleg Grenrus
Maintained by [email protected]
This version can be pinned in stack with:optics-core-0.4.1.1@sha256:45b92b72475c266134bfbdfcb4801df3a6487453e8a6c389623b7161661f8bfa,5555

Module documentation for 0.4.1.1

  • Data
    • Data.Either
      • Data.Either.Optics
    • Data.IntMap
      • Data.IntMap.Optics
    • Data.IntSet
      • Data.IntSet.Optics
    • Data.List
      • Data.List.Optics
    • Data.Map
      • Data.Map.Optics
    • Data.Maybe
      • Data.Maybe.Optics
    • Data.Sequence
      • Data.Sequence.Optics
    • Data.Set
      • Data.Set.Optics
    • Data.Tree
      • Data.Tree.Optics
    • Data.Tuple
      • Data.Tuple.Optics
    • Data.Typeable
      • Data.Typeable.Optics
  • GHC
    • GHC.Generics
      • GHC.Generics.Optics
  • Numeric
    • Numeric.Optics
  • Optics
    • Optics.AffineFold
    • Optics.AffineTraversal
    • Optics.Arrow
    • Optics.At
      • Optics.At.Core
    • Optics.Coerce
    • Optics.Cons
      • Optics.Cons.Core
    • Optics.Core
      • Optics.Core.Extras
    • Optics.Each
      • Optics.Each.Core
    • Optics.Empty
      • Optics.Empty.Core
    • Optics.Fold
    • Optics.Generic
    • Optics.Getter
    • Optics.Indexed
      • Optics.Indexed.Core
    • Optics.Internal
      • Optics.Internal.Bi
      • Optics.Internal.Fold
      • Optics.Internal.Generic
        • Optics.Internal.Generic.TypeLevel
      • Optics.Internal.Indexed
        • Optics.Internal.Indexed.Classes
      • Optics.Internal.IxFold
      • Optics.Internal.IxSetter
      • Optics.Internal.IxTraversal
      • Optics.Internal.Magic
      • Optics.Internal.Optic
        • Optics.Internal.Optic.Subtyping
        • Optics.Internal.Optic.TypeLevel
        • Optics.Internal.Optic.Types
      • Optics.Internal.Setter
      • Optics.Internal.Traversal
      • Optics.Internal.Utils
    • Optics.Iso
    • Optics.IxAffineFold
    • Optics.IxAffineTraversal
    • Optics.IxFold
    • Optics.IxGetter
    • Optics.IxLens
    • Optics.IxSetter
    • Optics.IxTraversal
    • Optics.Label
    • Optics.Lens
    • Optics.Mapping
    • Optics.Operators
      • Optics.Operators.Unsafe
    • Optics.Optic
    • Optics.Prism
    • Optics.Re
    • Optics.ReadOnly
    • Optics.ReversedLens
    • Optics.ReversedPrism
    • Optics.Review
    • Optics.Setter
    • Optics.Traversal

This package makes it possible to define and use Lenses, Traversals, Prisms and other optics, using an abstract interface.

This variant provides core definitions with a minimal dependency footprint. See the optics package (and its dependencies) for documentation and the "batteries-included" variant.

Changes

optics-core-0.4.1.1 (2023-06-22)

  • Add INLINE pragmas to small functions that really should inline

optics-core-0.4.1 (2022-03-22)

  • Add support for GHC-9.2
  • Add is (#410)
  • Improve error messages related to the JoinKinds class (#439)
  • Port universeOf, cosmosOf, paraOf, rewriteOf, transformOf, rewriteMOf and transformMOf from Control.Lens.Plated (#379)
  • Add (%?) composition operator (#434)

optics-core-0.4 (2021-02-22)

  • See migration-guide-0.4.md for more details
  • Add support for GHC-9.0
  • Drop support for GHC-8.0
  • The FunctorWithIndex, FoldableWithIndex and TraversableWithIndex type classes have been migrated to a new package, indexed-traversable (#370)
  • Add adjoin, iadjoin and both to Optics.[Ix]Traversal (#332, #372)
  • Add ifst and isnd to Optics.IxLens (#389)
  • Generalize types of generic (#376)
  • Make chosen an indexed lens to see which value is traversed (#335)
  • Remove GeneralLabelOptic extensibility mechanism (#361)
  • Add gfield, gafield, gconstructor, gposition and gplate for generics-based data access (#358, #361)
  • Add support for generics-based field lenses and constructor prisms (gfield and gconstructor) to LabelOptic so they can be used via OverloadedLabels (#361)
  • Remove unnecessary INLINE pragmas to reduce compile times (#394)
  • Simplify the type of (%) using new JoinKinds and AppendIndices classes in place of the Join and Append type families (#397, #399)

optics-core-0.3.0.1 (2020-08-05)

  • Add INLINE pragmas to atraverseOf_, iaTraverseOf_ and ignored
  • Improve error message in catch-all GeneralLabelOptic instance
  • Make GHC optimize away profunctor type classes when profiling is enabled
  • Improve documentation of Optics.Label:
    • Add guide on how to effectively use labels as optics
    • Restructure existing sections

optics-core-0.3 (2020-04-15)

  • GHC-8.10 support
  • Add filteredBy and unsafeFilteredBy
  • Add FunctorWithIndex, FoldableWithIndex and TraversableWithIndex instances for Const and Constant
  • Add afoldVL and iafoldVL constructors
  • Rename toAtraversalVL to atraverseOf, and toIxAtraversalVL to iatraverseOf
  • Generalise element and elementOf to construct IxAffineTraversals instead of IxTraversals
  • Change mapping to work on optic kinds other than Iso: it now supports Lens and Prism degenerating to Getter and Review respectively
  • Generalise ignored to be an IxAffineTraversal instead of an IxTraversal
  • Add singular and isingular
  • Add (^?!) operator
  • Expose Curry and CurryCompose
  • Show expected elimination forms on optic kind mismatch
  • Use stricter uncurry' for better performance
  • Add hidden LabelOptic instance to postpone instance resolution
  • Add GeneralLabelOptic for pluggable generic optics as labels
  • Document monoidal structures of Folds
  • Remove proxy argument from implies
  • Add itoList

optics-core-0.2 (2019-10-18)

  • Add non, non' and anon to Optics.Iso
  • ix can produce optic kinds other than AffineTraversal
  • Generalise type of generic1
  • Move some internal definitions out to new indexed-profunctors package
  • Introduce OpticKind and IxList type synonyms for better type inference
  • Make itraverse for Seq faster for containers >= 0.6.0
  • Assorted documentation improvements

optics-core-0.1 (2019-09-02)

  • Initial release