Skip to content

Commit

Permalink
haddocks: formatting, punctuation and linking
Browse files Browse the repository at this point in the history
  • Loading branch information
basdirks committed Jan 6, 2013
1 parent f68d2c3 commit 40e0b6c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/Control/Lens/Internal.hs
Expand Up @@ -886,10 +886,10 @@ class IndexedComonad w => IndexedComonadStore w where
context wabt = Context (`ipeek` wabt) (ipos wabt) context wabt = Context (`ipeek` wabt) (ipos wabt)


-- | The indexed store can be used to characterize a 'Control.Lens.Lens.Lens' -- | The indexed store can be used to characterize a 'Control.Lens.Lens.Lens'
-- and is used by 'Control.Lens.Lens.clone' -- and is used by 'Control.Lens.Lens.clone'.
-- --
-- @'Context' a b t@ is isomorphic to -- @'Context' a b t@ is isomorphic to
-- @newtype Context a b t = Context { runContext :: forall f. Functor f => (a -> f b) -> f t }@, -- @newtype 'Context' a b t = 'Context' { runContext :: forall f. 'Functor' f => (a -> f b) -> f t }@,
-- and to @exists s. (s, 'Control.Lens.Lens.Lens' s t a b)@. -- and to @exists s. (s, 'Control.Lens.Lens.Lens' s t a b)@.
-- --
-- A 'Context' is like a 'Control.Lens.Lens.Lens' that has already been applied to a some structure. -- A 'Context' is like a 'Control.Lens.Lens.Lens' that has already been applied to a some structure.
Expand Down
10 changes: 5 additions & 5 deletions src/Control/Lens/Iso.hs
Expand Up @@ -78,7 +78,7 @@ type AnIso s t a b = Exchange a b a (Mutator b) -> Exchange a b s (Mutator t)
type AnIso' s a = AnIso s s a a type AnIso' s a = AnIso s s a a




-- | Build a simple isomorphism from a pair of inverse functions -- | Build a simple isomorphism from a pair of inverse functions.
-- --
-- @ -- @
-- 'Control.Lens.Getter.view' ('iso' f g) ≡ f -- 'Control.Lens.Getter.view' ('iso' f g) ≡ f
Expand Down Expand Up @@ -107,7 +107,7 @@ from k = case runIso k of
-- This is useful when you need to store an isomorphism as a data type inside a container -- This is useful when you need to store an isomorphism as a data type inside a container
-- and later reconstitute it as an overloaded function. -- and later reconstitute it as an overloaded function.
-- --
-- See 'cloneLens' or 'Control.Lens.Traversal.cloneTraversal' for more information on why you might want to do this. -- See 'Control.Lens.Lens.cloneLens' or 'Control.Lens.Traversal.cloneTraversal' for more information on why you might want to do this.
cloneIso :: AnIso s t a b -> Iso s t a b cloneIso :: AnIso s t a b -> Iso s t a b
cloneIso k = case runIso k of cloneIso k = case runIso k of
(sa, bt) -> iso sa bt (sa, bt) -> iso sa bt
Expand All @@ -117,7 +117,7 @@ cloneIso k = case runIso k of
-- Isomorphisms families as Lenses -- Isomorphisms families as Lenses
----------------------------------------------------------------------------- -----------------------------------------------------------------------------


-- | Safely decompose 'AnIso' -- | Safely decompose 'AnIso'.
-- --
-- @'cloneIso' ≡ 'uncurry' 'iso' '.' 'runIso'@ -- @'cloneIso' ≡ 'uncurry' 'iso' '.' 'runIso'@
-- --
Expand Down Expand Up @@ -208,7 +208,7 @@ simple = id
-- | If @v@ is an element of a type @a@, and @a'@ is @a@ sans the element @v@, then @'non' v@ is an isomorphism from -- | If @v@ is an element of a type @a@, and @a'@ is @a@ sans the element @v@, then @'non' v@ is an isomorphism from
-- @'Maybe' a'@ to @a@. -- @'Maybe' a'@ to @a@.
-- --
-- Keep in mind this is only a real isomorphism if you treat the domain as being @'Maybe' (a sans v)@ -- Keep in mind this is only a real isomorphism if you treat the domain as being @'Maybe' (a sans v)@.
-- --
-- This is practically quite useful when you want to have a 'Data.Map.Map' where all the entries should have non-zero values. -- This is practically quite useful when you want to have a 'Data.Map.Map' where all the entries should have non-zero values.
-- --
Expand Down Expand Up @@ -242,7 +242,7 @@ non a = anon a (a==)


-- | @'anon' a p@ generalizes @'non' a@ to take any value and a predicate. -- | @'anon' a p@ generalizes @'non' a@ to take any value and a predicate.
-- --
-- This function assumes that @p a@ holds @'True'@ and generates an isomorphism between @'Maybe' (a | 'not' (p a))@ and @a@ -- This function assumes that @p a@ holds @'True'@ and generates an isomorphism between @'Maybe' (a | 'not' (p a))@ and @a@.
-- --
-- >>> Map.empty & at "hello" . anon Map.empty Map.null . at "world" ?~ "!!!" -- >>> Map.empty & at "hello" . anon Map.empty Map.null . at "world" ?~ "!!!"
-- fromList [("hello",fromList [("world","!!!")])] -- fromList [("hello",fromList [("world","!!!")])]
Expand Down
54 changes: 27 additions & 27 deletions src/Control/Lens/Lens.hs
Expand Up @@ -42,7 +42,7 @@
-- the 'Functor' part of the 'Applicative' it is supplied. -- the 'Functor' part of the 'Applicative' it is supplied.
-- --
-- Every 'Lens' can be used for 'Control.Lens.Getter.Getting' like a valid -- Every 'Lens' can be used for 'Control.Lens.Getter.Getting' like a valid
-- 'Control.Lens.Getter.Getter', since 'Functor' is a superclass of 'Control.Lens.Getter.Gettable' -- 'Control.Lens.Getter.Getter', since 'Functor' is a superclass of 'Control.Lens.Getter.Gettable'.
-- --
-- Since every 'Lens' can be used for 'Control.Lens.Getter.Getting' like a -- Since every 'Lens' can be used for 'Control.Lens.Getter.Getting' like a
-- valid 'Control.Lens.Getter.Getter' it follows that it must view exactly one element in the -- valid 'Control.Lens.Getter.Getter' it follows that it must view exactly one element in the
Expand Down Expand Up @@ -189,8 +189,8 @@ ilens sia sbt iafb s = sbt s <$> uncurry (indexed iafb) (sia s)
-- When applied to a 'Lens', it can edit the target of the 'Lens' in a -- When applied to a 'Lens', it can edit the target of the 'Lens' in a
-- structure, extracting a functorial result. -- structure, extracting a functorial result.
-- --
-- When applied to a 'Control.Lens.Traversal.Traversal', it can edit the -- When applied to a 'Traversal', it can edit the
-- targets of the 'Traversals', extracting an applicative summary of its -- targets of the 'Traversal's, extracting an applicative summary of its
-- actions. -- actions.
-- --
-- For all that the definition of this combinator is just: -- For all that the definition of this combinator is just:
Expand All @@ -204,10 +204,10 @@ ilens sia sbt iafb s = sbt s <$> uncurry (indexed iafb) (sia s)
-- @ -- @
-- --
-- It may be beneficial to think about it as if it had these even more -- It may be beneficial to think about it as if it had these even more
-- restrictive types, however: -- restricted types, however:
-- --
-- When applied to a 'Control.Lens.Traversal.Traversal', it can edit the -- When applied to a 'Traversal', it can edit the
-- targets of the 'Traversals', extracting a supplemental monoidal summary -- targets of the 'Traversal's, extracting a supplemental monoidal summary
-- of its actions, by choosing @f = ((,) m)@ -- of its actions, by choosing @f = ((,) m)@
-- --
-- @ -- @
Expand Down Expand Up @@ -267,8 +267,8 @@ inside l f es = o <$> f i where
-- @'chosen' ≡ 'choosing' 'id' 'id'@ -- @'chosen' ≡ 'choosing' 'id' 'id'@
-- --
-- @ -- @
-- 'choosing' :: 'Control.Lens.Getter.Getter' s a -> 'Control.Lens.Getter.Getter' s' a -> 'Control.Lens.Getter.Getter' ('Either' s s') a -- 'choosing' :: 'Control.Lens.Getter.Getter' s a -> 'Control.Lens.Getter.Getter' s' a -> 'Control.Lens.Getter.Getter' ('Either' s s') a
-- 'choosing' :: 'Control.Lens.Fold.Fold' s a -> 'Control.Lens.Fold.Fold' s' a -> 'Control.Lens.Fold.Fold' ('Either' s s') a -- 'choosing' :: 'Control.Lens.Fold.Fold' s a -> 'Control.Lens.Fold.Fold' s' a -> 'Control.Lens.Fold.Fold' ('Either' s s') a
-- 'choosing' :: 'Lens'' s a -> 'Lens'' s' a -> 'Lens'' ('Either' s s') a -- 'choosing' :: 'Lens'' s a -> 'Lens'' s' a -> 'Lens'' ('Either' s s') a
-- 'choosing' :: 'Control.Lens.Traversal.Traversal'' s a -> 'Control.Lens.Traversal.Traversal'' s' a -> 'Control.Lens.Traversal.Traversal'' ('Either' s s') a -- 'choosing' :: 'Control.Lens.Traversal.Traversal'' s a -> 'Control.Lens.Traversal.Traversal'' s' a -> 'Control.Lens.Traversal.Traversal'' ('Either' s s') a
-- 'choosing' :: 'Control.Lens.Setter.Setter'' s a -> 'Control.Lens.Setter.Setter'' s' a -> 'Control.Lens.Setter.Setter'' ('Either' s s') a -- 'choosing' :: 'Control.Lens.Setter.Setter'' s a -> 'Control.Lens.Setter.Setter'' s' a -> 'Control.Lens.Setter.Setter'' ('Either' s s') a
Expand Down Expand Up @@ -373,7 +373,7 @@ cloneIndexedLens l f s = runPretext (l sell s) (Indexed (indexed f))
-- Setting and Remembering -- Setting and Remembering
------------------------------------------------------------------------------- -------------------------------------------------------------------------------


-- | Modify the target of a 'Lens' and return the result -- | Modify the target of a 'Lens' and return the result.
-- --
-- When you do not need the result of the addition, ('Control.Lens.Setter.%~') is more flexible. -- When you do not need the result of the addition, ('Control.Lens.Setter.%~') is more flexible.
-- --
Expand All @@ -386,7 +386,7 @@ cloneIndexedLens l f s = runPretext (l sell s) (Indexed (indexed f))
l <%~ f = l $ rmap (\t -> (t, t)) f l <%~ f = l $ rmap (\t -> (t, t)) f
{-# INLINE (<%~) #-} {-# INLINE (<%~) #-}


-- | Increment the target of a numerically valued 'Lens' and return the result -- | Increment the target of a numerically valued 'Lens' and return the result.
-- --
-- When you do not need the result of the addition, ('Control.Lens.Setter.+~') is more flexible. -- When you do not need the result of the addition, ('Control.Lens.Setter.+~') is more flexible.
-- --
Expand All @@ -398,7 +398,7 @@ l <%~ f = l $ rmap (\t -> (t, t)) f
l <+~ a = l <%~ (+ a) l <+~ a = l <%~ (+ a)
{-# INLINE (<+~) #-} {-# INLINE (<+~) #-}


-- | Decrement the target of a numerically valued 'Lens' and return the result -- | Decrement the target of a numerically valued 'Lens' and return the result.
-- --
-- When you do not need the result of the subtraction, ('Control.Lens.Setter.-~') is more flexible. -- When you do not need the result of the subtraction, ('Control.Lens.Setter.-~') is more flexible.
-- --
Expand All @@ -410,7 +410,7 @@ l <+~ a = l <%~ (+ a)
l <-~ a = l <%~ subtract a l <-~ a = l <%~ subtract a
{-# INLINE (<-~) #-} {-# INLINE (<-~) #-}


-- | Multiply the target of a numerically valued 'Lens' and return the result -- | Multiply the target of a numerically valued 'Lens' and return the result.
-- --
-- When you do not need the result of the multiplication, ('Control.Lens.Setter.*~') is more -- When you do not need the result of the multiplication, ('Control.Lens.Setter.*~') is more
-- flexible. -- flexible.
Expand All @@ -436,7 +436,7 @@ l <//~ a = l <%~ (/ a)
{-# INLINE (<//~) #-} {-# INLINE (<//~) #-}


-- | Raise the target of a numerically valued 'Lens' to a non-negative -- | Raise the target of a numerically valued 'Lens' to a non-negative
-- 'Integral' power and return the result -- 'Integral' power and return the result.
-- --
-- When you do not need the result of the division, ('Control.Lens.Setter.^~') is more flexible. -- When you do not need the result of the division, ('Control.Lens.Setter.^~') is more flexible.
-- --
Expand Down Expand Up @@ -474,7 +474,7 @@ l <^^~ e = l <%~ (^^ e)
l <**~ a = l <%~ (** a) l <**~ a = l <%~ (** a)
{-# INLINE (<**~) #-} {-# INLINE (<**~) #-}


-- | Logically '||' a Boolean valued 'Lens' and return the result -- | Logically '||' a Boolean valued 'Lens' and return the result.
-- --
-- When you do not need the result of the operation, ('Control.Lens.Setter.||~') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.||~') is more flexible.
-- --
Expand All @@ -486,7 +486,7 @@ l <**~ a = l <%~ (** a)
l <||~ b = l <%~ (|| b) l <||~ b = l <%~ (|| b)
{-# INLINE (<||~) #-} {-# INLINE (<||~) #-}


-- | Logically '&&' a Boolean valued 'Lens' and return the result -- | Logically '&&' a Boolean valued 'Lens' and return the result.
-- --
-- When you do not need the result of the operation, ('Control.Lens.Setter.&&~') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.&&~') is more flexible.
-- --
Expand Down Expand Up @@ -537,8 +537,8 @@ l <<.~ b = l $ \a -> (a, b)
-- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible.
-- --
-- @ -- @
-- ('<%=') :: 'MonadState' s m => 'Lens'' s a -> (a -> a) -> m a -- ('<%=') :: 'MonadState' s m => 'Lens'' s a -> (a -> a) -> m a
-- ('<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a -- ('<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a
-- ('<%=') :: ('MonadState' s m, 'Monoid' a) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a -- ('<%=') :: ('MonadState' s m, 'Monoid' a) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a
-- @ -- @
(<%=) :: (Profunctor p, MonadState s m) => Overloading p (->) ((,)b) s s a b -> p a b -> m b (<%=) :: (Profunctor p, MonadState s m) => Overloading p (->) ((,)b) s s a b -> p a b -> m b
Expand Down Expand Up @@ -675,8 +675,8 @@ l <&&= b = l <%= (&& b)
-- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible.
-- --
-- @ -- @
-- ('<<%=') :: 'MonadState' s m => 'Lens'' s a -> (a -> a) -> m a -- ('<<%=') :: 'MonadState' s m => 'Lens'' s a -> (a -> a) -> m a
-- ('<<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a -- ('<<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a
-- ('<<%=') :: ('MonadState' s m, 'Monoid' b) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a -- ('<<%=') :: ('MonadState' s m, 'Monoid' b) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a
-- @ -- @
-- --
Expand All @@ -694,8 +694,8 @@ l <<%= f = l %%= lenticular f
-- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible.
-- --
-- @ -- @
-- ('<<%=') :: 'MonadState' s m => 'Lens'' s a -> (a -> a) -> m a -- ('<<%=') :: 'MonadState' s m => 'Lens'' s a -> (a -> a) -> m a
-- ('<<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a -- ('<<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a
-- ('<<%=') :: ('MonadState' s m, 'Monoid' t) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a -- ('<<%=') :: ('MonadState' s m, 'Monoid' t) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a
-- @ -- @
(<<.=) :: MonadState s m => LensLike ((,)a) s s a b -> b -> m a (<<.=) :: MonadState s m => LensLike ((,)a) s s a b -> b -> m a
Expand All @@ -719,17 +719,17 @@ l <<~ mb = do
{-# INLINE (<<~) #-} {-# INLINE (<<~) #-}


-- | 'mappend' a monoidal value onto the end of the target of a 'Lens' and -- | 'mappend' a monoidal value onto the end of the target of a 'Lens' and
-- return the result -- return the result.
-- --
-- When you do not need the result of the operation, ('<>~') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.<>~') is more flexible.
(<<>~) :: Monoid m => Overloading (->) q ((,)m) s t m m -> m -> q s (m, t) (<<>~) :: Monoid m => Overloading (->) q ((,)m) s t m m -> m -> q s (m, t)
l <<>~ m = l <%~ (`mappend` m) l <<>~ m = l <%~ (`mappend` m)
{-# INLINE (<<>~) #-} {-# INLINE (<<>~) #-}


-- | 'mappend' a monoidal value onto the end of the target of a 'Lens' into -- | 'mappend' a monoidal value onto the end of the target of a 'Lens' into
-- your monad's state and return the result. -- your monad's state and return the result.
-- --
-- When you do not need the result of the operation, ('<>=') is more flexible. -- When you do not need the result of the operation, ('Control.Lens.Setter.<>=') is more flexible.
(<<>=) :: (MonadState s m, Monoid r) => LensLike' ((,)r) s r -> r -> m r (<<>=) :: (MonadState s m, Monoid r) => LensLike' ((,)r) s r -> r -> m r
l <<>= r = l <%= (`mappend` r) l <<>= r = l <%= (`mappend` r)
{-# INLINE (<<>=) #-} {-# INLINE (<<>=) #-}
Expand All @@ -746,10 +746,10 @@ l <<>= r = l <%= (`mappend` r)
-- --
-- When you do not need access to the index then ('<%~') is more liberal in what it can accept. -- When you do not need access to the index then ('<%~') is more liberal in what it can accept.
-- --
-- If you do not need the intermediate result, you can use ('%@~') or even ('%~'). -- If you do not need the intermediate result, you can use ('Control.Lens.Setter.%@~') or even ('Control.Lens.Setter.%~').
-- --
-- @ -- @
-- ('<%@~') :: 'IndexedLens' i s t a b -> (i -> a -> b) -> s -> (b, t) -- ('<%@~') :: 'IndexedLens' i s t a b -> (i -> a -> b) -> s -> (b, t)
-- ('<%@~') :: 'Monoid' b => 'Control.Lens.Traversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> (b, t) -- ('<%@~') :: 'Monoid' b => 'Control.Lens.Traversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> (b, t)
-- @ -- @
(<%@~) :: Overloading (Indexed i) q ((,) b) s t a b -> (i -> a -> b) -> q s (b, t) (<%@~) :: Overloading (Indexed i) q ((,) b) s t a b -> (i -> a -> b) -> q s (b, t)
Expand All @@ -768,7 +768,7 @@ l <%@~ f = l (Indexed $ \i a -> let b = f i a in (b, b))
-- @ -- @
-- --
-- In particular, it is often useful to think of this function as having one of these even more -- In particular, it is often useful to think of this function as having one of these even more
-- restrictive type signatures -- restricted type signatures:
-- --
-- @ -- @
-- ('%%@~') :: 'IndexedLens' i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) -- ('%%@~') :: 'IndexedLens' i s t a b -> (i -> a -> (r, b)) -> s -> (r, t)
Expand Down
4 changes: 2 additions & 2 deletions src/Control/Lens/Type.hs
Expand Up @@ -100,8 +100,8 @@ import Data.Profunctor
-- You can also use a 'Lens' for 'Control.Lens.Getter.Getting' as if it were a -- You can also use a 'Lens' for 'Control.Lens.Getter.Getting' as if it were a
-- 'Fold' or 'Getter'. -- 'Fold' or 'Getter'.
-- --
-- Since every lens is a valid 'Traversal', the -- Since every 'Lens' is a valid 'Traversal', the
-- traversal laws are required of any lenses you create: -- 'Traversal' laws are required of any lenses you create:
-- --
-- @ -- @
-- l 'pure' ≡ 'pure' -- l 'pure' ≡ 'pure'
Expand Down

0 comments on commit 40e0b6c

Please sign in to comment.