optics
Optics as an abstract interface
| Version on this page: | 0.4.2.1 | 
| LTS Haskell 24.18: | 0.4.2.1@rev:1 | 
| Stackage Nightly 2025-11-03: | 0.4.2.1@rev:1 | 
| Latest on Hackage: | 0.4.2.1@rev:1 | 
optics-0.4.2.1@sha256:04875ac4aebeb36ccd7ce486353a6c0310a013d5a22f4209c41521ee2f258bff,7353Module documentation for 0.4.2.1
This package makes it possible to define and use Lenses, Traversals, Prisms
and other optics, using an abstract interface. See the main module Optics
for the documentation.
This is the "batteries-included" variant with many dependencies; see the
optics-core package and
other optics-* dependencies if you need a more limited dependency footprint.
Changes
optics-0.4.2.1 (2023-06-22)
- Fix compilation of tests with GHC 9.4 and 9.6
 
optics-0.4.2 (2022-05-19)
- 
Allow
transformers-0.6andmtl-2.3Note that
optics-extrano longer definesZoominstances forErrorTorListTwhen building withmtl-2.3or later. This is becauseMonadStateis a superclass ofZoom, and theMonadStateinstances forErrorTandListTwere removed inmtl-2.3. Be watchful of this if you buildoptics-extrawithmtl-2.3(or later) combined with an older version oftransformers(pre-0.6) that definesErrorTorListT. Similarly forMagnifyandMagnifyMany. 
optics-0.4.1 (2022-03-22)
- Add support for GHC-9.2
 - Add 
is(#410) - Improve error messages related to the 
JoinKindsclass (#439) - Port 
universeOf,cosmosOf,paraOf,rewriteOf,transformOf,rewriteMOfandtransformMOffromControl.Lens.Plated(#379) - Add 
(%?)composition operator (#434) 
optics-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,FoldableWithIndexandTraversableWithIndextype classes have been migrated to a new package,indexed-traversable(#370) - Add 
adjoin,iadjoinandbothtoOptics.[Ix]Traversal(#332, #372) - Add 
ifstandisndtoOptics.IxLens(#389) - Generalize types of 
generic(#376) - Make 
chosenan indexed lens to see which value is traversed (#335) - Remove 
GeneralLabelOpticextensibility mechanism (#361) - Add 
gfield,gafield,gconstructor,gpositionandgplatefor generics-based data access (#358, #361) - Add support for generics-based field lenses and constructor prisms (
gfieldandgconstructor) toLabelOpticso they can be used viaOverloadedLabels(#361) - Remove unnecessary INLINE pragmas to reduce compile times (#394)
 - Simplify the type of 
(%)using newJoinKindsandAppendIndicesclasses in place of theJoinandAppendtype families (#397, #399) - Print missing language extensions during TH generation of labels if there are any (#352)
 - Add support for getters of rank1 polymorphic fields to optics generated with
the 
makeFieldLabelsfamily of functions (#365) - Extend support of type-changing optics generated with the 
makeFieldLabelsfamily to type parameters that are phantom and applied to non-injective type families (#365) - Fix TH generation of optics for poly-kinded data families (#378)
 - Fix 
declareFieldLabelswhen a field type refers to a type defined in the same quote (#380) 
optics-0.3 (2020-04-15)
- GHC-8.10 support
 - Add 
filteredByandunsafeFilteredBy - Add 
FunctorWithIndex,FoldableWithIndexandTraversableWithIndexinstances forConstandConstant - Add 
afoldVLandiafoldVLconstructors - Rename 
toAtraversalVLtoatraverseOf, andtoIxAtraversalVLtoiatraverseOf - Generalise 
elementandelementOfto constructIxAffineTraversals instead ofIxTraversals - Change 
mappingto work on optic kinds other thanIso: it now supportsLensandPrismdegenerating toGetterandReviewrespectively - Generalise 
ignoredto be anIxAffineTraversalinstead of anIxTraversal - Add 
singularandisingular - Add 
(^?!)operator - Expose 
CurryandCurryCompose - Show expected elimination forms on optic kind mismatch
 - Use stricter 
uncurryfor better performance - Add hidden 
LabelOpticinstance to postpone instance resolution - Add 
GeneralLabelOpticfor pluggable generic optics as labels - Document monoidal structures of 
Folds - Remove proxy argument from 
implies - Add 
itoList - Improvements to TH-generated optics:
LabelOpticinstances make optic kind a type equality for better type inferenceLabelOpticinstances for field optics work properly in the presence of type families- Fixed calculation of phantom types in 
LabelOpticprism instances - Better support for generating optics in the presence of kind polymorphism
 
 
optics-0.2 (2019-10-18)
- Add 
non,non'andanontoOptics.Iso ixcan produce optic kinds other thanAffineTraversal- Generalise type of 
generic1 - Move 
usefromOptics.ViewtoOptics.Stateand restrict its type - Add 
preusetoOptics.State - Rename 
use,uses,listeningandlisteningsto reflect the fact that they haveViewResult-generalised types - Add 
noPrefixFieldLabelsandnoPrefixNamertoOptics.TH - Move some internal definitions out to new 
indexed-profunctorspackage - Introduce 
OpticKindandIxListtype synonyms for better type inference - Make 
itraverseforSeqfaster forcontainers >= 0.6.0 - Assorted documentation improvements
 
optics-0.1 (2019-09-02)
- Initial release