Skip to content
Newer
Older
100644 567 lines (505 sloc) 21.3 KB
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
1 {-# LANGUAGE CPP #-}
2 {-# LANGUAGE GADTs #-}
3 {-# LANGUAGE Rank2Types #-}
4 {-# LANGUAGE FlexibleContexts #-}
5 {-# LANGUAGE FlexibleInstances #-}
6 {-# LANGUAGE ScopedTypeVariables #-}
7 {-# LANGUAGE MultiParamTypeClasses #-}
b54e109 @shachaf (f :: * -> *) in the definition of Equality
shachaf authored Dec 24, 2012
8 {-# LANGUAGE KindSignatures #-}
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
9 -------------------------------------------------------------------------------
10 -- |
11 -- Module : Control.Lens.Type
b44dc90 @ekmett Updated copyright date
authored Jan 17, 2013
12 -- Copyright : (C) 2012-13 Edward Kmett
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
13 -- License : BSD-style (see the file LICENSE)
14 -- Maintainer : Edward Kmett <ekmett@gmail.com>
15 -- Stability : provisional
16 -- Portability : Rank2Types
17 --
d7a3589 @ekmett more docs
authored Jan 1, 2013
18 -- This module exports the majority of the types that need to appear in user
19 -- signatures or in documentation when talking about lenses. The remaining types
20 -- for consuming lenses are distributed across various modules in the hierarchy.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
21 -------------------------------------------------------------------------------
22 module Control.Lens.Type
23 (
a2cd8c1 @ekmett lots of new types
authored Jan 1, 2013
24 -- * Other
7d87edf @tel The `As a` type is `Equality' a a` and easily constrains polymorphism.
tel authored Sep 2, 2013
25 Equality, Equality', As
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
26 , Iso, Iso'
27 , Prism , Prism'
a2cd8c1 @ekmett lots of new types
authored Jan 1, 2013
28 -- * Lenses, Folds and Traversals
29 , Lens, Lens'
30 , Traversal, Traversal'
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
31 , Setter, Setter'
a2cd8c1 @ekmett lots of new types
authored Jan 1, 2013
32 , Getter, Fold
33 , Action, MonadicFold
34 -- * Indexed
35 , IndexedLens, IndexedLens'
36 , IndexedTraversal, IndexedTraversal'
37 , IndexedSetter, IndexedSetter'
38 , IndexedGetter, IndexedFold
39 , IndexedAction, IndexedMonadicFold
40 -- * Index-Preserving
41 , IndexPreservingLens, IndexPreservingLens'
42 , IndexPreservingTraversal, IndexPreservingTraversal'
43 , IndexPreservingSetter, IndexPreservingSetter'
44 , IndexPreservingGetter, IndexPreservingFold
45 , IndexPreservingAction, IndexPreservingMonadicFold
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
46 -- * Common
47 , Simple
48 , LensLike, LensLike'
7440d39 @ekmett Shorter signatures
authored Jan 15, 2013
49 , Over, Over'
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
50 , IndexedLensLike, IndexedLensLike'
51 , Overloading, Overloading'
6687426 @ekmett more equalities and docfixes
authored Dec 23, 2012
52 , Overloaded, Overloaded'
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
53 ) where
54
55 import Control.Applicative
0983498 @ekmett Split up the rest of the Control.Lens.Internal dependencies from Cont…
authored Jan 12, 2013
56 import Control.Lens.Internal.Action
57 import Control.Lens.Internal.Setter
58 import Control.Lens.Internal.Indexed
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
59 import Data.Functor.Contravariant
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
60 import Data.Profunctor
61
62 -- $setup
8c8177f @ekmett >>> :set -XNoOverloadedStrings
authored Jan 26, 2013
63 -- >>> :set -XNoOverloadedStrings
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
64 -- >>> import Control.Lens
65 -- >>> import Debug.SimpleReflect.Expr
66 -- >>> import Debug.SimpleReflect.Vars as Vars hiding (f,g,h)
67 -- >>> let f :: Expr -> Expr; f = Debug.SimpleReflect.Vars.f
68 -- >>> let g :: Expr -> Expr; g = Debug.SimpleReflect.Vars.g
69 -- >>> let h :: Expr -> Expr -> Expr; h = Debug.SimpleReflect.Vars.h
70 -- >>> let getter :: Expr -> Expr; getter = fun "getter"
71 -- >>> let setter :: Expr -> Expr -> Expr; setter = fun "setter"
5095463 @ekmett fixed prism test
authored Dec 22, 2012
72 -- >>> import Numeric.Natural
e95b155 @ion1 Prism, Type: Apply the previous fix to the right place; remove $setup…
ion1 authored Dec 23, 2012
73 -- >>> let nat :: Prism' Integer Natural; nat = prism toInteger $ \i -> if i < 0 then Left i else Right (fromInteger i)
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
74
75 -------------------------------------------------------------------------------
76 -- Lenses
77 -------------------------------------------------------------------------------
78
79 -- | A 'Lens' is actually a lens family as described in
80 -- <http://comonad.com/reader/2012/mirrored-lenses/>.
81 --
82 -- With great power comes great responsibility and a 'Lens' is subject to the
9eaef5c @basdirks haddocks: misc
basdirks authored Jan 11, 2013
83 -- three common sense 'Lens' laws:
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
84 --
85 -- 1) You get back what you put in:
86 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
87 -- @
88 -- 'Control.Lens.Getter.view' l ('Control.Lens.Setter.set' l b a) ≡ b
89 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
90 --
91 -- 2) Putting back what you got doesn't change anything:
92 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
93 -- @
94 -- 'Control.Lens.Setter.set' l ('Control.Lens.Getter.view' l a) a ≡ a
95 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
96 --
97 -- 3) Setting twice is the same as setting once:
98 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
99 -- @
100 -- 'Control.Lens.Setter.set' l c ('Control.Lens.Setter.set' l b a) ≡ 'Control.Lens.Setter.set' l c a
101 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
102 --
103 -- These laws are strong enough that the 4 type parameters of a 'Lens' cannot
104 -- vary fully independently. For more on how they interact, read the \"Why is
105 -- it a Lens Family?\" section of
106 -- <http://comonad.com/reader/2012/mirrored-lenses/>.
107 --
108 -- Every 'Lens' can be used directly as a 'Control.Lens.Setter.Setter' or
109 -- 'Traversal'.
110 --
111 -- You can also use a 'Lens' for 'Control.Lens.Getter.Getting' as if it were a
112 -- 'Fold' or 'Getter'.
113 --
40e0b6c @basdirks haddocks: formatting, punctuation and linking
basdirks authored Jan 6, 2013
114 -- Since every 'Lens' is a valid 'Traversal', the
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
115 -- 'Traversal' laws are required of any 'Lens' you create:
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
116 --
117 -- @
118 -- l 'pure' ≡ 'pure'
119 -- 'fmap' (l f) '.' l g ≡ 'Data.Functor.Compose.getCompose' '.' l ('Data.Functor.Compose.Compose' '.' 'fmap' f '.' g)
120 -- @
121 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
122 -- @
123 -- type 'Lens' s t a b = forall f. 'Functor' f => 'LensLike' f s t a b
124 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
125 type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
126
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
127 -- | @
128 -- type 'Lens'' = 'Simple' 'Lens'
129 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
130 type Lens' s a = Lens s s a a
131
132 -- | Every 'IndexedLens' is a valid 'Lens' and a valid 'Control.Lens.Traversal.IndexedTraversal'.
133 type IndexedLens i s t a b = forall f p. (Indexable i p, Functor f) => p a (f b) -> s -> f t
134
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
135 -- | @
136 -- type 'IndexedLens'' i = 'Simple' ('IndexedLens' i)
137 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
138 type IndexedLens' i s a = IndexedLens i s s a a
139
d7a3589 @ekmett more docs
authored Jan 1, 2013
140 -- | An 'IndexPreservingLens' leaves any index it is composed with alone.
a8f2396 @ekmett Split Control.Lens.Internal into several modules. Added many missing …
authored Jan 12, 2013
141 type IndexPreservingLens s t a b = forall p f. (Conjoined p, Functor f) => p a (f b) -> p s (f t)
f47d227 @ekmett Added cloneIndexPreservingLens, cloneIndexPreservingTraversal, cloneI…
authored Dec 31, 2012
142
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
143 -- | @
144 -- type 'IndexPreservingLens'' = 'Simple' 'IndexPreservingLens'
145 -- @
f47d227 @ekmett Added cloneIndexPreservingLens, cloneIndexPreservingTraversal, cloneI…
authored Jan 1, 2013
146 type IndexPreservingLens' s a = IndexPreservingLens s s a a
147
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
148 ------------------------------------------------------------------------------
149 -- Traversals
150 ------------------------------------------------------------------------------
151
152 -- | A 'Traversal' can be used directly as a 'Control.Lens.Setter.Setter' or a 'Fold' (but not as a 'Lens') and provides
153 -- the ability to both read and update multiple fields, subject to some relatively weak 'Traversal' laws.
154 --
155 -- These have also been known as multilenses, but they have the signature and spirit of
156 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
157 -- @
158 -- 'Data.Traversable.traverse' :: 'Data.Traversable.Traversable' f => 'Traversal' (f a) (f b) a b
159 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
160 --
161 -- and the more evocative name suggests their application.
162 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
163 -- Most of the time the 'Traversal' you will want to use is just 'Data.Traversable.traverse', but you can also pass any
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
164 -- 'Lens' or 'Iso' as a 'Traversal', and composition of a 'Traversal' (or 'Lens' or 'Iso') with a 'Traversal' (or 'Lens' or 'Iso')
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
165 -- using ('.') forms a valid 'Traversal'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
166 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
167 -- The laws for a 'Traversal' @t@ follow from the laws for 'Data.Traversable.Traversable' as stated in \"The Essence of the Iterator Pattern\".
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
168 --
169 -- @
170 -- t 'pure' ≡ 'pure'
171 -- 'fmap' (t f) '.' t g ≡ 'Data.Functor.Compose.getCompose' '.' t ('Data.Functor.Compose.Compose' '.' 'fmap' f '.' g)
172 -- @
173 --
174 -- One consequence of this requirement is that a 'Traversal' needs to leave the same number of elements as a
175 -- candidate for subsequent 'Traversal' that it started with. Another testament to the strength of these laws
176 -- is that the caveat expressed in section 5.5 of the \"Essence of the Iterator Pattern\" about exotic
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
177 -- 'Data.Traversable.Traversable' instances that 'Data.Traversable.traverse' the same entry multiple times was actually already ruled out by the
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
178 -- second law in that same paper!
179 type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t
180
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
181 -- | @
182 -- type 'Traversal'' = 'Simple' 'Traversal'
183 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
184 type Traversal' s a = Traversal s s a a
185
9eaef5c @basdirks haddocks: misc
basdirks authored Jan 11, 2013
186 -- | Every 'IndexedTraversal' is a valid 'Control.Lens.Traversal.Traversal' or
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
187 -- 'Control.Lens.Fold.IndexedFold'.
188 --
189 -- The 'Indexed' constraint is used to allow an 'IndexedTraversal' to be used
190 -- directly as a 'Control.Lens.Traversal.Traversal'.
191 --
192 -- The 'Control.Lens.Traversal.Traversal' laws are still required to hold.
f47d227 @ekmett Added cloneIndexPreservingLens, cloneIndexPreservingTraversal, cloneI…
authored Jan 1, 2013
193 type IndexedTraversal i s t a b = forall p f. (Indexable i p, Applicative f) => p a (f b) -> s -> f t
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
194
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
195 -- | @
196 -- type 'IndexedTraversal'' i = 'Simple' ('IndexedTraversal' i)
197 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
198 type IndexedTraversal' i s a = IndexedTraversal i s s a a
199
d7a3589 @ekmett more docs
authored Jan 1, 2013
200 -- | An 'IndexPreservingLens' leaves any index it is composed with alone.
a8f2396 @ekmett Split Control.Lens.Internal into several modules. Added many missing …
authored Jan 12, 2013
201 type IndexPreservingTraversal s t a b = forall p f. (Conjoined p, Applicative f) => p a (f b) -> p s (f t)
f47d227 @ekmett Added cloneIndexPreservingLens, cloneIndexPreservingTraversal, cloneI…
authored Jan 1, 2013
202
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
203 -- | @
204 -- type 'IndexPreservingTraversal'' = 'Simple' 'IndexPreservingTraversal'
205 -- @
f47d227 @ekmett Added cloneIndexPreservingLens, cloneIndexPreservingTraversal, cloneI…
authored Jan 1, 2013
206 type IndexPreservingTraversal' s a = IndexPreservingTraversal s s a a
207
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
208 ------------------------------------------------------------------------------
209 -- Setters
210 ------------------------------------------------------------------------------
211
7a1c95e @basdirks haddocks: post-"Internalization" clean-up, round 3
basdirks authored Jan 14, 2013
212 -- | The only 'LensLike' law that can apply to a 'Setter' @l@ is that
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
213 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
214 -- @
215 -- 'Control.Lens.Setter.set' l y ('Control.Lens.Setter.set' l x a) ≡ 'Control.Lens.Setter.set' l y a
216 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
217 --
f5f1b94 @basdirks haddocks: linking in Setter and Type
basdirks authored Jan 8, 2013
218 -- You can't 'Control.Lens.Getter.view' a 'Setter' in general, so the other two laws are irrelevant.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
219 --
220 -- However, two 'Functor' laws apply to a 'Setter':
221 --
222 -- @
f5f1b94 @basdirks haddocks: linking in Setter and Type
basdirks authored Jan 8, 2013
223 -- 'Control.Lens.Setter.over' l 'id' ≡ 'id'
224 -- 'Control.Lens.Setter.over' l f '.' 'Control.Lens.Setter.over' l g ≡ 'Control.Lens.Setter.over' l (f '.' g)
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
225 -- @
226 --
9eaef5c @basdirks haddocks: misc
basdirks authored Jan 11, 2013
227 -- These can be stated more directly:
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
228 --
229 -- @
230 -- l 'pure' ≡ 'pure'
f5f1b94 @basdirks haddocks: linking in Setter and Type
basdirks authored Jan 8, 2013
231 -- l f '.' 'untainted' '.' l g ≡ l (f '.' 'untainted' '.' g)
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
232 -- @
233 --
f5f1b94 @basdirks haddocks: linking in Setter and Type
basdirks authored Jan 8, 2013
234 -- You can compose a 'Setter' with a 'Lens' or a 'Traversal' using ('.') from the @Prelude@
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
235 -- and the result is always only a 'Setter' and nothing more.
236 --
237 -- >>> over traverse f [a,b,c,d]
238 -- [f a,f b,f c,f d]
239 --
240 -- >>> over _1 f (a,b)
241 -- (f a,b)
242 --
243 -- >>> over (traverse._1) f [(a,b),(c,d)]
244 -- [(f a,b),(f c,d)]
245 --
246 -- >>> over both f (a,b)
247 -- (f a,f b)
248 --
249 -- >>> over (traverse.both) f [(a,b),(c,d)]
250 -- [(f a,f b),(f c,f d)]
251 type Setter s t a b = forall f. Settable f => (a -> f b) -> s -> f t
252
be96579 @basdirks haddocks: linking, formatting and periods in Cons, Each, Equality, Fo…
basdirks authored Jan 12, 2013
253 -- | A 'Setter'' is just a 'Setter' that doesn't change the types.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
254 --
255 -- These are particularly common when talking about monomorphic containers. /e.g./
256 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
257 -- @
258 -- 'sets' Data.Text.map :: 'Setter'' 'Data.Text.Internal.Text' 'Char'
259 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
260 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
261 -- @
262 -- type 'Setter'' = 'Setter''
263 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
264 type Setter' s a = Setter s s a a
265
f5f1b94 @basdirks haddocks: linking in Setter and Type
basdirks authored Jan 8, 2013
266 -- | Every 'IndexedSetter' is a valid 'Setter'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
267 --
268 -- The 'Setter' laws are still required to hold.
269 type IndexedSetter i s t a b = forall f p.
270 (Indexable i p, Settable f) => p a (f b) -> s -> f t
271
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
272 -- | @
273 -- type 'IndexedSetter'' i = 'Simple' ('IndexedSetter' i)
274 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
275 type IndexedSetter' i s a = IndexedSetter i s s a a
276
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
277 -- | An 'IndexPreservingSetter' can be composed with a 'IndexedSetter', 'IndexedTraversal' or 'IndexedLens'
278 -- and leaves the index intact, yielding an 'IndexedSetter'.
a8f2396 @ekmett Split Control.Lens.Internal into several modules. Added many missing …
authored Jan 12, 2013
279 type IndexPreservingSetter s t a b = forall p f. (Conjoined p, Settable f) => p a (f b) -> p s (f t)
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
280
82adbd5 @ekmett better haddock coverage
authored Jan 21, 2013
281 -- | @
282 -- type 'IndexedPreservingSetter'' i = 'Simple' 'IndexedPreservingSetter'
283 -- @
f47d227 @ekmett Added cloneIndexPreservingLens, cloneIndexPreservingTraversal, cloneI…
authored Jan 1, 2013
284 type IndexPreservingSetter' s a = IndexPreservingSetter s s a a
285
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
286 -----------------------------------------------------------------------------
287 -- Isomorphisms
288 -----------------------------------------------------------------------------
289
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
290 -- | Isomorphism families can be composed with another 'Lens' using ('.') and 'id'.
5291c96 @ekmett Added notes about the index-preserving nature of Iso, Prism and Equal…
authored Dec 29, 2012
291 --
a2cd8c1 @ekmett lots of new types
authored Jan 1, 2013
292 -- Note: Composition with an 'Iso' is index- and measure- preserving.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
293 type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t)
294
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
295 -- | @
296 -- type 'Iso'' = 'Control.Lens.Type.Simple' 'Iso'
297 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
298 type Iso' s a = Iso s s a a
299
300 ------------------------------------------------------------------------------
301 -- Prism Internals
302 ------------------------------------------------------------------------------
303
215d32b @basdirks haddocks cosmetics in Prism, Reified, Type
basdirks authored Jan 8, 2013
304 -- | A 'Prism' @l@ is a 0-or-1 target 'Traversal' that can also be turned
544cdaa @ehird Remove references to remit from the documentation
ehird authored Jan 12, 2013
305 -- around with 'Control.Lens.Review.re' to obtain a 'Getter' in the
215d32b @basdirks haddocks cosmetics in Prism, Reified, Type
basdirks authored Jan 8, 2013
306 -- opposite direction.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
307 --
308 -- There are two laws that a 'Prism' should satisfy:
309 --
c283fea @mauke docs: preview is in Control.Lens.Fold, not .Type
mauke authored Feb 4, 2013
310 -- First, if I 'Control.Lens.Review.re' or 'Control.Lens.Prism.review' a value with a 'Prism' and then 'Control.Lens.Fold.preview' or use ('Control.Lens.Fold.^?'), I will get it back:
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
311 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
312 -- @
c283fea @mauke docs: preview is in Control.Lens.Fold, not .Type
mauke authored Feb 4, 2013
313 -- 'Control.Lens.Fold.preview' l ('Control.Lens.Prism.review' l b) ≡ 'Just' b
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
314 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
315 --
215d32b @basdirks haddocks cosmetics in Prism, Reified, Type
basdirks authored Jan 8, 2013
316 -- Second, if you can extract a value @a@ using a 'Prism' @l@ from a value @s@, then the value @s@ is completely described my @l@ and @a@:
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
317 --
c283fea @mauke docs: preview is in Control.Lens.Fold, not .Type
mauke authored Feb 4, 2013
318 -- If @'Control.Lens.Fold.preview' l s ≡ 'Just' a@ then @'Control.Lens.Prism.review' l a ≡ s@
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
319 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
320 -- These two laws imply that the 'Traversal' laws hold for every 'Prism' and that we 'Data.Traversable.traverse' at most 1 element:
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
321 --
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
322 -- @
323 -- 'Control.Lens.Fold.lengthOf' l x '<=' 1
324 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
325 --
326 -- It may help to think of this as a 'Iso' that can be partial in one direction.
327 --
328 -- Every 'Prism' is a valid 'Traversal'.
329 --
330 -- Every 'Iso' is a valid 'Prism'.
331 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
332 -- For example, you might have a @'Prism'' 'Integer' 'Numeric.Natural.Natural'@ allows you to always
333 -- go from a 'Numeric.Natural.Natural' to an 'Integer', and provide you with tools to check if an 'Integer' is
334 -- a 'Numeric.Natural.Natural' and/or to edit one if it is.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
335 --
336 --
337 -- @
338 -- 'nat' :: 'Prism'' 'Integer' 'Numeric.Natural.Natural'
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
339 -- 'nat' = 'Control.Lens.Prism.prism' 'toInteger' '$' \\ i ->
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
340 -- if i '<' 0
341 -- then 'Left' i
342 -- else 'Right' ('fromInteger' i)
343 -- @
344 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
345 -- Now we can ask if an 'Integer' is a 'Numeric.Natural.Natural'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
346 --
347 -- >>> 5^?nat
348 -- Just 5
349 --
350 -- >>> (-5)^?nat
351 -- Nothing
352 --
353 -- We can update the ones that are:
354 --
355 -- >>> (-3,4) & both.nat *~ 2
356 -- (-3,8)
357 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
358 -- And we can then convert from a 'Numeric.Natural.Natural' to an 'Integer'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
359 --
1d79c2d @ekmett Converted `remit` to `re` in doctests and other test suites.
authored Jan 10, 2013
360 -- >>> 5 ^. re nat -- :: Natural
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
361 -- 5
362 --
26fb229 @basdirks haddocks: post-"Internalization" clean-up, round 6
basdirks authored Jan 14, 2013
363 -- Similarly we can use a 'Prism' to 'Data.Traversable.traverse' the 'Left' half of an 'Either':
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
364 --
78a1d4f @ekmett Renamed _left -> _Left, _right -> _Right, _just -> _Just for consistency
authored Jan 10, 2013
365 -- >>> Left "hello" & _Left %~ length
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
366 -- Left 5
367 --
368 -- or to construct an 'Either':
369 --
78a1d4f @ekmett Renamed _left -> _Left, _right -> _Right, _just -> _Just for consistency
authored Jan 10, 2013
370 -- >>> 5^.re _Left
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
371 -- Left 5
372 --
373 -- such that if you query it with the 'Prism', you will get your original input back.
374 --
78a1d4f @ekmett Renamed _left -> _Left, _right -> _Right, _just -> _Just for consistency
authored Jan 10, 2013
375 -- >>> 5^.re _Left ^? _Left
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
376 -- Just 5
377 --
378 -- Another interesting way to think of a 'Prism' is as the categorical dual of a 'Lens'
26fb229 @basdirks haddocks: post-"Internalization" clean-up, round 6
basdirks authored Jan 14, 2013
379 -- -- a co-'Lens', so to speak. This is what permits the construction of 'Control.Lens.Prism.outside'.
5291c96 @ekmett Added notes about the index-preserving nature of Iso, Prism and Equal…
authored Dec 30, 2012
380 --
ffe3253 @ekmett s/Iso/Prism
authored Dec 29, 2012
381 -- Note: Composition with a 'Prism' is index-preserving.
90bef20 @ekmett Converted to using Choice and Strong
authored Jan 13, 2013
382 type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t)
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
383
215d32b @basdirks haddocks cosmetics in Prism, Reified, Type
basdirks authored Jan 8, 2013
384 -- | A 'Simple' 'Prism'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
385 type Prism' s a = Prism s s a a
386
387 -------------------------------------------------------------------------------
3ce55f4 @ekmett Added 'Control.Lens.Equality'
authored Dec 23, 2012
388 -- Equality
389 -------------------------------------------------------------------------------
390
a142679 @basdirks haddocks: more linking
basdirks authored Jan 5, 2013
391 -- | A witness that @(a ~ s, b ~ t)@.
5291c96 @ekmett Added notes about the index-preserving nature of Iso, Prism and Equal…
authored Dec 30, 2012
392 --
393 -- Note: Composition with an 'Equality' is index-preserving.
b54e109 @shachaf (f :: * -> *) in the definition of Equality
shachaf authored Dec 24, 2012
394 type Equality s t a b = forall p (f :: * -> *). p a (f b) -> p s (f t)
3ce55f4 @ekmett Added 'Control.Lens.Equality'
authored Dec 23, 2012
395
9eaef5c @basdirks haddocks: misc
basdirks authored Jan 11, 2013
396 -- | A 'Simple' 'Equality'.
3ce55f4 @ekmett Added 'Control.Lens.Equality'
authored Dec 23, 2012
397 type Equality' s a = Equality s s a a
398
7d87edf @tel The `As a` type is `Equality' a a` and easily constrains polymorphism.
tel authored Sep 3, 2013
399 -- | Composable `asTypeOf`. Useful for constraining excess
400 -- polymorphism, @foo . (id :: As Int) . bar@.
401 type As a = Equality' a a
402
3ce55f4 @ekmett Added 'Control.Lens.Equality'
authored Dec 23, 2012
403 -------------------------------------------------------------------------------
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
404 -- Getters
405 -------------------------------------------------------------------------------
406
407 -- | A 'Getter' describes how to retrieve a single value in a way that can be
7a1c95e @basdirks haddocks: post-"Internalization" clean-up, round 3
basdirks authored Jan 14, 2013
408 -- composed with other 'LensLike' constructions.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
409 --
410 -- Unlike a 'Lens' a 'Getter' is read-only. Since a 'Getter'
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
411 -- cannot be used to write back there are no 'Lens' laws that can be applied to
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
412 -- it. In fact, it is isomorphic to an arbitrary function from @(a -> s)@.
413 --
414 -- Moreover, a 'Getter' can be used directly as a 'Control.Lens.Fold.Fold',
415 -- since it just ignores the 'Applicative'.
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
416 type Getter s a = forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
417
70c7f3e @basdirks Getter.hs haddocks formatting, punctuation and linking.
basdirks authored Jan 5, 2013
418 -- | Every 'IndexedGetter' is a valid 'Control.Lens.Fold.IndexedFold' and can be used for 'Control.Lens.Getter.Getting' like a 'Getter'.
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
419 type IndexedGetter i s a = forall p f. (Indexable i p, Contravariant f, Functor f) => p a (f a) -> s -> f s
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
420
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
421 -- | An 'IndexPreservingGetter' can be used as a 'Getter', but when composed with an 'IndexedTraversal',
422 -- 'IndexedFold', or 'IndexedLens' yields an 'IndexedFold', 'IndexedFold' or 'IndexedGetter' respectively.
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
423 type IndexPreservingGetter s a = forall p f. (Conjoined p, Contravariant f, Functor f) => p a (f a) -> p s (f s)
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
424
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
425 --------------------------
426 -- Folds
427 --------------------------
428
429 -- | A 'Fold' describes how to retrieve multiple values in a way that can be composed
7a1c95e @basdirks haddocks: post-"Internalization" clean-up, round 3
basdirks authored Jan 14, 2013
430 -- with other 'LensLike' constructions.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
431 --
a142679 @basdirks haddocks: more linking
basdirks authored Jan 5, 2013
432 -- A @'Fold' s a@ provides a structure with operations very similar to those of the 'Data.Foldable.Foldable'
433 -- typeclass, see 'Control.Lens.Fold.foldMapOf' and the other 'Fold' combinators.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
434 --
a142679 @basdirks haddocks: more linking
basdirks authored Jan 5, 2013
435 -- By convention, if there exists a 'foo' method that expects a @'Data.Foldable.Foldable' (f a)@, then there should be a
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
436 -- @fooOf@ method that takes a @'Fold' s a@ and a value of type @s@.
437 --
a142679 @basdirks haddocks: more linking
basdirks authored Jan 5, 2013
438 -- A 'Getter' is a legal 'Fold' that just ignores the supplied 'Data.Monoid.Monoid'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
439 --
440 -- Unlike a 'Control.Lens.Traversal.Traversal' a 'Fold' is read-only. Since a 'Fold' cannot be used to write back
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
441 -- there are no 'Lens' laws that apply.
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
442 type Fold s a = forall f. (Contravariant f, Applicative f) => (a -> f a) -> s -> f s
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
443
a142679 @basdirks haddocks: more linking
basdirks authored Jan 5, 2013
444 -- | Every 'IndexedFold' is a valid 'Control.Lens.Fold.Fold' and can be used for 'Control.Lens.Getter.Getting'.
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
445 type IndexedFold i s a = forall p f. (Indexable i p, Contravariant f, Applicative f) => p a (f a) -> s -> f s
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
446
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
447 -- | An 'IndexPreservingFold' can be used as a 'Fold', but when composed with an 'IndexedTraversal',
448 -- 'IndexedFold', or 'IndexedLens' yields an 'IndexedFold' respectively.
f8bc980 @ekmett Replaced 'Gettable' with 'Contravariant'
authored Feb 3, 2013
449 type IndexPreservingFold s a = forall p f. (Conjoined p, Contravariant f, Applicative f) => p a (f a) -> p s (f s)
3ce55f4 @ekmett Added 'Control.Lens.Equality'
authored Dec 23, 2012
450
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
451 -------------------------------------------------------------------------------
452 -- Actions
453 -------------------------------------------------------------------------------
454
455 -- | An 'Action' is a 'Getter' enriched with access to a 'Monad' for side-effects.
456 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
457 -- Every 'Getter' can be used as an 'Action'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
458 --
459 -- You can compose an 'Action' with another 'Action' using ('Prelude..') from the @Prelude@.
460 type Action m s a = forall f r. Effective m r f => (a -> f a) -> s -> f s
461
462 -- | An 'IndexedAction' is an 'IndexedGetter' enriched with access to a 'Monad' for side-effects.
463 --
d5b5a70 @basdirks haddocks: linking in Type
basdirks authored Jan 9, 2013
464 -- Every 'Getter' can be used as an 'Action'.
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
465 --
466 -- You can compose an 'Action' with another 'Action' using ('Prelude..') from the @Prelude@.
467 type IndexedAction i m s a = forall p f r. (Indexable i p, Effective m r f) => p a (f a) -> s -> f s
468
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
469 -- | An 'IndexPreservingAction' can be used as a 'Action', but when composed with an 'IndexedTraversal',
470 -- 'IndexedFold', or 'IndexedLens' yields an 'IndexedMonadicFold', 'IndexedMonadicFold' or 'IndexedAction' respectively.
a8f2396 @ekmett Split Control.Lens.Internal into several modules. Added many missing …
authored Jan 12, 2013
471 type IndexPreservingAction m s a = forall p f r. (Conjoined p, Effective m r f) => p a (f a) -> p s (f s)
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
472
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
473 -------------------------------------------------------------------------------
474 -- MonadicFolds
475 -------------------------------------------------------------------------------
476
477 -- | A 'MonadicFold' is a 'Fold' enriched with access to a 'Monad' for side-effects.
478 --
479 -- Every 'Fold' can be used as a 'MonadicFold', that simply ignores the access to the 'Monad'.
480 --
481 -- You can compose a 'MonadicFold' with another 'MonadicFold' using ('Prelude..') from the @Prelude@.
482 type MonadicFold m s a = forall f r. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s
483
484 -- | An 'IndexedMonadicFold' is an 'IndexedFold' enriched with access to a 'Monad' for side-effects.
485 --
486 -- Every 'IndexedFold' can be used as an 'IndexedMonadicFold', that simply ignores the access to the 'Monad'.
487 --
488 -- You can compose an 'IndexedMonadicFold' with another 'IndexedMonadicFold' using ('Prelude..') from the @Prelude@.
489 type IndexedMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Applicative f) => p a (f a) -> s -> f s
490
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
491 -- | An 'IndexPreservingFold' can be used as a 'Fold', but when composed with an 'IndexedTraversal',
492 -- 'IndexedFold', or 'IndexedLens' yields an 'IndexedFold' respectively.
a8f2396 @ekmett Split Control.Lens.Internal into several modules. Added many missing …
authored Jan 12, 2013
493 type IndexPreservingMonadicFold m s a = forall p f r. (Conjoined p, Effective m r f, Applicative f) => p a (f a) -> p s (f s)
918cd2d @ekmett IndexPreservingGetters, IndexPreservingFolds, IndexPreservingSetters,…
authored Dec 27, 2012
494
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
495 -------------------------------------------------------------------------------
496 -- Simple Overloading
497 -------------------------------------------------------------------------------
498
499 -- | A 'Simple' 'Lens', 'Simple' 'Traversal', ... can
500 -- be used instead of a 'Lens','Traversal', ...
501 -- whenever the type variables don't change upon setting a value.
502 --
503 -- @
2fafabc @glguy Docfix: More doc type fixes
glguy authored Feb 11, 2013
504 -- 'Data.Complex.Lens._imagPart' :: 'Simple' 'Lens' ('Data.Complex.Complex' a) a
7dd734e @glguy Docfix: More doc type fixes
glguy authored Feb 11, 2013
505 -- 'Control.Lens.Traversal.traversed' :: 'Simple' ('IndexedTraversal' 'Int') [a] a
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
506 -- @
507 --
508 -- Note: To use this alias in your own code with @'LensLike' f@ or
509 -- 'Setter', you may have to turn on @LiberalTypeSynonyms@.
510 --
511 -- This is commonly abbreviated as a \"prime\" marker, /e.g./ 'Lens'' = 'Simple' 'Lens'.
512 type Simple f s a = f s s a a
513
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
514 -- | @
515 -- type 'LensLike' f s t a b = 'Overloading' (->) (->) f s t a b
516 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
517 type Overloading p q f s t a b = p a (f b) -> q s (f t)
518
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
519 -- | @
520 -- type 'Overloading'' p q f s a = 'Simple' ('Overloading' p q f) s a
521 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
522 type Overloading' p q f s a = Overloading p q f s s a a
523
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
524 -- | @
525 -- type 'LensLike' f s t a b = 'Overloaded' (->) f s t a b
526 -- @
6687426 @ekmett more equalities and docfixes
authored Dec 23, 2012
527 type Overloaded p f s t a b = p a (f b) -> p s (f t)
528
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
529 -- | @
530 -- type 'Overloaded'' p q f s a = 'Simple' ('Overloaded' p q f) s a
531 -- @
6687426 @ekmett more equalities and docfixes
authored Dec 23, 2012
532 type Overloaded' p f s a = Overloaded p f s s a a
533
be96579 @basdirks haddocks: linking, formatting and periods in Cons, Each, Equality, Fo…
basdirks authored Jan 12, 2013
534 -- | Many combinators that accept a 'Lens' can also accept a
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
535 -- 'Traversal' in limited situations.
536 --
537 -- They do so by specializing the type of 'Functor' that they require of the
538 -- caller.
539 --
540 -- If a function accepts a @'LensLike' f s t a b@ for some 'Functor' @f@,
541 -- then they may be passed a 'Lens'.
542 --
543 -- Further, if @f@ is an 'Applicative', they may also be passed a
544 -- 'Traversal'.
545 type LensLike f s t a b = (a -> f b) -> s -> f t
546
f502561 @basdirks haddocks: some corrections and links, changed single line code blocks…
basdirks authored Jan 21, 2013
547 -- | @
548 -- type 'LensLike'' f = 'Simple' ('LensLike' f)
549 -- @
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
550 type LensLike' f s a = LensLike f s s a a
551
105b1b4 @basdirks haddocks: post-"Internalization" clean-up, round 4
basdirks authored Jan 14, 2013
552 -- | Convenient alias for constructing indexed lenses and their ilk.
3fe8e0b @ekmett Removed more q Profunctor references
authored Jan 10, 2013
553 type IndexedLensLike i f s t a b = forall p. Indexable i p => p a (f b) -> s -> f t
6be7786 @ekmett Factoring out Control.Lens.Type
authored Dec 22, 2012
554
105b1b4 @basdirks haddocks: post-"Internalization" clean-up, round 4
basdirks authored Jan 14, 2013
555 -- | Convenient alias for constructing simple indexed lenses and their ilk.
3fe8e0b @ekmett Removed more q Profunctor references
authored Jan 10, 2013
556 type IndexedLensLike' i f s a = IndexedLensLike i f s s a a
557
82adbd5 @ekmett better haddock coverage
authored Jan 21, 2013
558 -- | This is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.
7440d39 @ekmett Shorter signatures
authored Jan 16, 2013
559 type Over p f s t a b = p a (f b) -> s -> f t
3fe8e0b @ekmett Removed more q Profunctor references
authored Jan 10, 2013
560
82adbd5 @ekmett better haddock coverage
authored Jan 21, 2013
561 -- | This is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.
562 --
563 -- @
564 -- type 'Over'' p f = 'Simple' ('Over' p f)
565 -- @
7440d39 @ekmett Shorter signatures
authored Jan 16, 2013
566 type Over' p f s a = Over p f s s a a
Something went wrong with that request. Please try again.