Skip to content

Commit cbf678c

Browse files
Improve and remove docstrings (#144)
1 parent 973d567 commit cbf678c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/Data/Lens/Types.purs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,23 @@ type Lens s t a b = forall p. Strong p => Optic p s t a b
8686

8787
type 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`.
9091
type Prism s t a b = forall p. Choice p => Optic p s t a b
9192
type 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.
9499
type Iso s t a b = forall p. Profunctor p => Optic p s t a b
95100
type 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.
98106
type Traversal s t a b = forall p. Wander p => Optic p s t a b
99107
type Traversal' s a = Traversal s s a a
100108

@@ -153,7 +161,6 @@ type Grate' s a = Grate s s a a
153161
type AGrate s t a b = Optic (Grating a b) s t a b
154162
type AGrate' s a = AGrate s s a a
155163

156-
-- | A getter.
157164
type Getter :: Type -> Type -> Type -> Type -> Type
158165
type 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

165172
type AGetter' s a = AGetter s s a a
166173

167-
-- | A setter.
168174
type Setter s t a b = Optic Function s t a b
169175
type Setter' s a = Setter s s a a
170176

171-
-- | A review.
172177
type Review :: Type -> Type -> Type -> Type -> Type
173178
type Review s t a b = Optic Tagged s t a b
174179

175180
type Review' s a = Review s s a a
176181

177-
-- | A fold.
178182
type Fold :: Type -> Type -> Type -> Type -> Type -> Type
179183
type Fold r s t a b = Optic (Forget r) s t a b
180184

181185
type Fold' r s a = Fold r s s a a
182186

183-
-- | An indexed optic.
184187
type IndexedOptic :: (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Type -> Type
185188
type IndexedOptic p i s t a b = Indexed p i a b -> p s t
186189

187190
type IndexedOptic' p i s a = IndexedOptic p i s s a a
188191

189-
-- | An indexed traversal.
190192
type IndexedTraversal i s t a b = forall p. Wander p => IndexedOptic p i s t a b
191193
type IndexedTraversal' i s a = IndexedTraversal i s s a a
192194

193-
-- | An indexed fold.
194195
type IndexedFold :: Type -> Type -> Type -> Type -> Type -> Type -> Type
195196
type IndexedFold r i s t a b = IndexedOptic (Forget r) i s t a b
196197

197198
type IndexedFold' r i s a = IndexedFold r i s s a a
198199

199-
-- | An indexed getter.
200200
type IndexedGetter :: Type -> Type -> Type -> Type -> Type -> Type
201201
type IndexedGetter i s t a b = IndexedFold a i s t a b
202202

203203
type IndexedGetter' i s a = IndexedGetter i s s a a
204204

205-
-- | An indexed setter.
206205
type IndexedSetter i s t a b = IndexedOptic Function i s t a b
207206
type IndexedSetter' i s a = IndexedSetter i s s a a

0 commit comments

Comments
 (0)