@@ -86,15 +86,23 @@ type Lens s t a b = forall p. Strong p => Optic p s t a b
8686
8787type Lens' s a = Lens s s a a
8888
89- -- | A prism.
89+ -- | Prisms are used for sum types like `Maybe` and `Either`.
90+ -- | The specialized type `Prism' s a` means that the type `s` might contain a value of type `a`.
9091type Prism s t a b = forall p . Choice p => Optic p s t a b
9192type Prism' s a = Prism s s a a
9293
93- -- | A generalized isomorphism.
94+ -- | A generalized isomorphism.
95+ -- | Isos are the most constrained optic, simply enabling you to transform back and forth between two types without losing information.
96+ -- | The specialized type `Iso' s a` means that `s` and `a` are isomorphic – the two types represent the same information.
97+ -- | They’re especially useful when you need to unwrap a newtype or transform an array to a list or otherwise convert between types.
98+ -- | This optic is also useful for backward compatibility without boilerplate.
9499type Iso s t a b = forall p . Profunctor p => Optic p s t a b
95100type Iso' s a = Iso s s a a
96101
97- -- | A traversal.
102+ -- | The specialized type `Traversal s a` means that the type `s` contains zero, one, or many values of type `a`.
103+ -- | They're especially useful when working with collections like arrays, maps, and any other member of the `Traversable` type class.
104+ -- | They are also a more general form of lenses and prisms.
105+ -- | Traversals which focus on at most one element (like lenses, prisms, and their composition) are called affine traversals.
98106type Traversal s t a b = forall p . Wander p => Optic p s t a b
99107type Traversal' s a = Traversal s s a a
100108
@@ -153,7 +161,6 @@ type Grate' s a = Grate s s a a
153161type AGrate s t a b = Optic (Grating a b ) s t a b
154162type AGrate' s a = AGrate s s a a
155163
156- -- | A getter.
157164type Getter :: Type -> Type -> Type -> Type -> Type
158165type Getter s t a b = forall r . Fold r s t a b
159166
@@ -164,44 +171,36 @@ type AGetter s t a b = Fold a s t a b
164171
165172type AGetter' s a = AGetter s s a a
166173
167- -- | A setter.
168174type Setter s t a b = Optic Function s t a b
169175type Setter' s a = Setter s s a a
170176
171- -- | A review.
172177type Review :: Type -> Type -> Type -> Type -> Type
173178type Review s t a b = Optic Tagged s t a b
174179
175180type Review' s a = Review s s a a
176181
177- -- | A fold.
178182type Fold :: Type -> Type -> Type -> Type -> Type -> Type
179183type Fold r s t a b = Optic (Forget r ) s t a b
180184
181185type Fold' r s a = Fold r s s a a
182186
183- -- | An indexed optic.
184187type IndexedOptic :: (Type -> Type -> Type ) -> Type -> Type -> Type -> Type -> Type -> Type
185188type IndexedOptic p i s t a b = Indexed p i a b -> p s t
186189
187190type IndexedOptic' p i s a = IndexedOptic p i s s a a
188191
189- -- | An indexed traversal.
190192type IndexedTraversal i s t a b = forall p . Wander p => IndexedOptic p i s t a b
191193type IndexedTraversal' i s a = IndexedTraversal i s s a a
192194
193- -- | An indexed fold.
194195type IndexedFold :: Type -> Type -> Type -> Type -> Type -> Type -> Type
195196type IndexedFold r i s t a b = IndexedOptic (Forget r ) i s t a b
196197
197198type IndexedFold' r i s a = IndexedFold r i s s a a
198199
199- -- | An indexed getter.
200200type IndexedGetter :: Type -> Type -> Type -> Type -> Type -> Type
201201type IndexedGetter i s t a b = IndexedFold a i s t a b
202202
203203type IndexedGetter' i s a = IndexedGetter i s s a a
204204
205- -- | An indexed setter.
206205type IndexedSetter i s t a b = IndexedOptic Function i s t a b
207206type IndexedSetter' i s a = IndexedSetter i s s a a
0 commit comments