@@ -27,21 +27,45 @@ import Data.Profunctor.Choice (class Choice)
2727import Data.Profunctor.Closed (class Closed )
2828import Data.Profunctor.Strong (class Strong )
2929
30- -- | A general-purpose Data.Lens.
31- type Optic p s t a b = p a b -> p s t
32- type Optic' p s a = Optic p s s a a
30+ -- | Given a type whose "focus element" can always be retrieved,
31+ -- | a lens provides a convenient way to view, get, and transform
32+ -- | that element.
33+ -- |
34+ -- | `_2` is a Tuple-specific `Lens` available from `Data.Lens`, so:
35+ -- | ```purescript
36+ -- | > import Data.Lens
37+ -- | > over _2 String.length $ Tuple "ignore" "four"
38+ -- | (Tuple "ignore" 4)
39+ -- | ```
40+ type Lens s t a b = forall p . Strong p => Optic p s t a b
41+
42+ -- | `Lens` allows `set` to change the type of the focus. Often, a
43+ -- | particular lens won't do that. This type alias declares that `set`
44+ -- | only changes values, not types.
45+ type Lens' s a = Lens s s a a
46+
47+ -- | A prism.
48+ type Prism s t a b = forall p . Choice p => Optic p s t a b
49+ type Prism' s a = Prism s s a a
3350
3451-- | A generalized isomorphism.
3552type Iso s t a b = forall p . Profunctor p => Optic p s t a b
3653type Iso' s a = Iso s s a a
3754
55+ -- | A traversal.
56+ type Traversal s t a b = forall p . Wander p => Optic p s t a b
57+ type Traversal' s a = Traversal s s a a
58+
59+
60+
61+
62+ -- | A general-purpose Data.Lens.
63+ type Optic p s t a b = p a b -> p s t
64+ type Optic' p s a = Optic p s s a a
65+
3866type AnIso s t a b = Optic (Exchange a b ) s t a b
3967type AnIso' s a = AnIso s s a a
4068
41- -- | A lens.
42- type Lens s t a b = forall p . Strong p => Optic p s t a b
43- type Lens' s a = Lens s s a a
44-
4569type ALens s t a b = Optic (Shop a b ) s t a b
4670type ALens' s a = ALens s s a a
4771
@@ -52,17 +76,9 @@ type IndexedLens' i s a = IndexedLens i s s a a
5276type AnIndexedLens i s t a b = IndexedOptic (Shop (Tuple i a ) b ) i s t a b
5377type AnIndexedLens' i s a = AnIndexedLens i s s a a
5478
55- -- | A prism.
56- type Prism s t a b = forall p . Choice p => Optic p s t a b
57- type Prism' s a = Prism s s a a
58-
5979type APrism s t a b = Optic (Market a b ) s t a b
6080type APrism' s a = APrism s s a a
6181
62- -- | A traversal.
63- type Traversal s t a b = forall p . Wander p => Optic p s t a b
64- type Traversal' s a = Traversal s s a a
65-
6682-- | A grate (http://r6research.livejournal.com/28050.html)
6783type Grate s t a b = forall p . Closed p => Optic p s t a b
6884type Grate' s a = Grate s s a a
0 commit comments