{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Trustworthy #-}
#if __GLASGOW_HASKELL__ >= 806
{-# LANGUAGE PolyKinds #-}
#else
{-# LANGUAGE TypeInType #-}
#endif
#include "lens-common.h"
module Control.Lens.Lens
(
Lens, Lens'
, IndexedLens, IndexedLens'
, ALens, ALens'
, AnIndexedLens, AnIndexedLens'
, lens, ilens, iplens, withLens
, (%%~), (%%=)
, (%%@~), (%%@=)
, (<%@~), (<%@=)
, (<<%@~), (<<%@=)
, (&), (<&>), (??)
, (&~)
, choosing
, chosen
, alongside
, inside
, (<%~), (<+~), (<-~), (<*~), (<//~)
, (<^~), (<^^~), (<**~)
, (<||~), (<&&~), (<<>~)
, (<<%~), (<<.~), (<<?~), (<<+~), (<<-~), (<<*~)
, (<<//~), (<<^~), (<<^^~), (<<**~)
, (<<||~), (<<&&~), (<<<>~)
, (<%=), (<+=), (<-=), (<*=), (<//=)
, (<^=), (<^^=), (<**=)
, (<||=), (<&&=), (<<>=)
, (<<%=), (<<.=), (<<?=), (<<+=), (<<-=), (<<*=)
, (<<//=), (<<^=), (<<^^=), (<<**=)
, (<<||=), (<<&&=), (<<<>=)
, (<<~)
, cloneLens
, cloneIndexPreservingLens
, cloneIndexedLens
, overA
, storing
, (^#)
, (#~), (#%~), (#%%~), (<#~), (<#%~)
, (#=), (#%=), (#%%=), (<#=), (<#%=)
, devoid
, united
, head1, last1
, Context(..)
, Context'
, locus
, fusing
) where
import Prelude ()
import Control.Arrow
import Control.Comonad
import Control.Lens.Internal.Context
import Control.Lens.Internal.Prelude
import Control.Lens.Internal.Getter
import Control.Lens.Internal.Indexed
import Control.Lens.Type
import Control.Monad.State as State
import Data.Functor.Apply
import Data.Functor.Reverse
import Data.Functor.Yoneda
import Data.Semigroup.Traversable
import GHC.Exts (TYPE)
infixl 8 ^#
infixr 4 %%@~, <%@~, <<%@~, %%~, <+~, <*~, <-~, <//~, <^~, <^^~, <**~, <&&~, <||~, <<>~, <%~, <<%~, <<.~, <<?~, <#~, #~, #%~, <#%~, #%%~
, <<+~, <<-~, <<*~, <<//~, <<^~, <<^^~, <<**~, <<||~, <<&&~, <<<>~
infix 4 %%@=, <%@=, <<%@=, %%=, <+=, <*=, <-=, <//=, <^=, <^^=, <**=, <&&=, <||=, <<>=, <%=, <<%=, <<.=, <<?=, <#=, #=, #%=, <#%=, #%%=
, <<+=, <<-=, <<*=, <<//=, <<^=, <<^^=, <<**=, <<||=, <<&&=, <<<>=
infixr 2 <<~
infixl 1 ??, &~
type ALens s t a b = LensLike (Pretext (->) a b) s t a b
type ALens' s a = ALens s s a a
type AnIndexedLens i s t a b = Optical (Indexed i) (->) (Pretext (Indexed i) a b) s t a b
type AnIndexedLens' i s a = AnIndexedLens i s s a a
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
lens :: forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens s -> a
sa s -> b -> t
sbt a -> f b
afb s
s = s -> b -> t
sbt s
s (b -> t) -> f b -> f t
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
afb (s -> a
sa s
s)
{-# INLINE lens #-}
withLens :: forall s t a b rep (r :: TYPE rep).
ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r
withLens :: forall s t a b r.
ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r
withLens ALens s t a b
l (s -> a) -> (s -> b -> t) -> r
f = (s -> a) -> (s -> b -> t) -> r
f (s -> ALens s t a b -> a
forall s t a b. s -> ALens s t a b -> a
^# ALens s t a b
l) ((b -> s -> t) -> s -> b -> t
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ALens s t a b -> b -> s -> t
forall s t a b. ALens s t a b -> b -> s -> t
storing ALens s t a b
l))
{-# INLINE withLens #-}
iplens :: (s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b
iplens :: forall s a b t.
(s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b
iplens s -> a
sa s -> b -> t
sbt p a (f b)
pafb = (Corep p s -> f t) -> p s (f t)
forall d c. (Corep p d -> c) -> p d c
forall (p :: * -> * -> *) d c.
Corepresentable p =>
(Corep p d -> c) -> p d c
cotabulate ((Corep p s -> f t) -> p s (f t))
-> (Corep p s -> f t) -> p s (f t)
forall a b. (a -> b) -> a -> b
$ \Corep p s
ws -> s -> b -> t
sbt (Corep p s -> s
forall a. Corep p a -> a
forall (w :: * -> *) a. Comonad w => w a -> a
extract Corep p s
ws) (b -> t) -> f b -> f t
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> p a (f b) -> Corep p a -> f b
forall a b. p a b -> Corep p a -> b
forall (p :: * -> * -> *) (f :: * -> *) a b.
Cosieve p f =>
p a b -> f a -> b
cosieve p a (f b)
pafb (s -> a
sa (s -> a) -> Corep p s -> Corep p a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Corep p s
ws)
{-# INLINE iplens #-}
ilens :: (s -> (i, a)) -> (s -> b -> t) -> IndexedLens i s t a b
ilens :: forall s i a b t.
(s -> (i, a)) -> (s -> b -> t) -> IndexedLens i s t a b
ilens s -> (i, a)
sia s -> b -> t
sbt p a (f b)
iafb s
s = s -> b -> t
sbt s
s (b -> t) -> f b -> f t
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (i -> a -> f b) -> (i, a) -> f b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (p a (f b) -> i -> a -> f b
forall a b. p a b -> i -> a -> b
forall i (p :: * -> * -> *) a b.
Indexable i p =>
p a b -> i -> a -> b
indexed p a (f b)
iafb) (s -> (i, a)
sia s
s)
{-# INLINE ilens #-}
(&~) :: s -> State s a -> s
s
s &~ :: forall s a. s -> State s a -> s
&~ State s a
l = State s a -> s -> s
forall s a. State s a -> s -> s
execState State s a
l s
s
{-# INLINE (&~) #-}
(%%~) :: LensLike f s t a b -> (a -> f b) -> s -> f t
%%~ :: forall {k} (f :: k -> *) s (t :: k) a (b :: k).
LensLike f s t a b -> LensLike f s t a b
(%%~) = LensLike f s t a b -> LensLike f s t a b
forall a. a -> a
id
{-# INLINE (%%~) #-}
(%%=) :: MonadState s m => Over p ((,) r) s s a b -> p a (r, b) -> m r
Over p ((,) r) s s a b
l %%= :: forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= p a (r, b)
f = (s -> (r, s)) -> m r
forall a. (s -> (a, s)) -> m a
forall s (m :: * -> *) a. MonadState s m => (s -> (a, s)) -> m a
State.state (Over p ((,) r) s s a b
l p a (r, b)
f)
{-# INLINE (%%=) #-}
(??) :: Functor f => f (a -> b) -> a -> f b
f (a -> b)
fab ?? :: forall (f :: * -> *) a b. Functor f => f (a -> b) -> a -> f b
?? a
a = ((a -> b) -> b) -> f (a -> b) -> f b
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> b) -> a -> b
forall a b. (a -> b) -> a -> b
$ a
a) f (a -> b)
fab
{-# INLINE (??) #-}
inside :: Corepresentable p => ALens s t a b -> Lens (p e s) (p e t) (p e a) (p e b)
inside :: forall (p :: * -> * -> *) s t a b e.
Corepresentable p =>
ALens s t a b -> Lens (p e s) (p e t) (p e a) (p e b)
inside ALens s t a b
l p e a -> f (p e b)
f p e s
es = p e b -> p e t
o (p e b -> p e t) -> f (p e b) -> f (p e t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> p e a -> f (p e b)
f p e a
i where
i :: p e a
i = (Corep p e -> a) -> p e a
forall d c. (Corep p d -> c) -> p d c
forall (p :: * -> * -> *) d c.
Corepresentable p =>
(Corep p d -> c) -> p d c
cotabulate ((Corep p e -> a) -> p e a) -> (Corep p e -> a) -> p e a
forall a b. (a -> b) -> a -> b
$ \ Corep p e
e -> Pretext (->) a b t -> a
forall a c t. Pretext (->) a c t -> a
forall (w :: * -> * -> * -> *) a c t.
IndexedComonadStore w =>
w a c t -> a
ipos (Pretext (->) a b t -> a) -> Pretext (->) a b t -> a
forall a b. (a -> b) -> a -> b
$ ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell (p e s -> Corep p e -> s
forall a b. p a b -> Corep p a -> b
forall (p :: * -> * -> *) (f :: * -> *) a b.
Cosieve p f =>
p a b -> f a -> b
cosieve p e s
es Corep p e
e)
o :: p e b -> p e t
o p e b
ea = (Corep p e -> t) -> p e t
forall d c. (Corep p d -> c) -> p d c
forall (p :: * -> * -> *) d c.
Corepresentable p =>
(Corep p d -> c) -> p d c
cotabulate ((Corep p e -> t) -> p e t) -> (Corep p e -> t) -> p e t
forall a b. (a -> b) -> a -> b
$ \ Corep p e
e -> b -> Pretext (->) a b t -> t
forall c a t. c -> Pretext (->) a c t -> t
forall (w :: * -> * -> * -> *) c a t.
IndexedComonadStore w =>
c -> w a c t -> t
ipeek (p e b -> Corep p e -> b
forall a b. p a b -> Corep p a -> b
forall (p :: * -> * -> *) (f :: * -> *) a b.
Cosieve p f =>
p a b -> f a -> b
cosieve p e b
ea Corep p e
e) (Pretext (->) a b t -> t) -> Pretext (->) a b t -> t
forall a b. (a -> b) -> a -> b
$ ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell (p e s -> Corep p e -> s
forall a b. p a b -> Corep p a -> b
forall (p :: * -> * -> *) (f :: * -> *) a b.
Cosieve p f =>
p a b -> f a -> b
cosieve p e s
es Corep p e
e)
{-# INLINE inside #-}
choosing :: Functor f
=> LensLike f s t a b
-> LensLike f s' t' a b
-> LensLike f (Either s s') (Either t t') a b
choosing :: forall (f :: * -> *) s t a b s' t'.
Functor f =>
LensLike f s t a b
-> LensLike f s' t' a b
-> LensLike f (Either s s') (Either t t') a b
choosing LensLike f s t a b
l LensLike f s' t' a b
_ a -> f b
f (Left s
a) = t -> Either t t'
forall a b. a -> Either a b
Left (t -> Either t t') -> f t -> f (Either t t')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f s t a b
l a -> f b
f s
a
choosing LensLike f s t a b
_ LensLike f s' t' a b
r a -> f b
f (Right s'
a') = t' -> Either t t'
forall a b. b -> Either a b
Right (t' -> Either t t') -> f t' -> f (Either t t')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f s' t' a b
r a -> f b
f s'
a'
{-# INLINE choosing #-}
chosen :: IndexPreservingLens (Either a a) (Either b b) a b
chosen :: forall a b (p :: * -> * -> *) (f :: * -> *).
(Conjoined p, Functor f) =>
p a (f b) -> p (Either a a) (f (Either b b))
chosen p a (f b)
pafb = (Corep p (Either a a) -> f (Either b b))
-> p (Either a a) (f (Either b b))
forall d c. (Corep p d -> c) -> p d c
forall (p :: * -> * -> *) d c.
Corepresentable p =>
(Corep p d -> c) -> p d c
cotabulate ((Corep p (Either a a) -> f (Either b b))
-> p (Either a a) (f (Either b b)))
-> (Corep p (Either a a) -> f (Either b b))
-> p (Either a a) (f (Either b b))
forall a b. (a -> b) -> a -> b
$ \Corep p (Either a a)
weaa -> p (Either a a) (f b) -> Corep p (Either a a) -> f b
forall a b. p a b -> Corep p a -> b
forall (p :: * -> * -> *) (f :: * -> *) a b.
Cosieve p f =>
p a b -> f a -> b
cosieve ((a -> a) -> (a -> a) -> Either a a -> a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either a -> a
forall a. a -> a
id a -> a
forall a. a -> a
id (Either a a -> a) -> p a (f b) -> p (Either a a) (f b)
forall a b c. (a -> b) -> p b c -> p a c
forall (p :: * -> * -> *) a b c.
Profunctor p =>
(a -> b) -> p b c -> p a c
`lmap` p a (f b)
pafb) Corep p (Either a a)
weaa f b -> (b -> Either b b) -> f (Either b b)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \b
b -> case Corep p (Either a a) -> Either a a
forall a. Corep p a -> a
forall (w :: * -> *) a. Comonad w => w a -> a
extract Corep p (Either a a)
weaa of
Left a
_ -> b -> Either b b
forall a b. a -> Either a b
Left b
b
Right a
_ -> b -> Either b b
forall a b. b -> Either a b
Right b
b
{-# INLINE chosen #-}
alongside :: LensLike (AlongsideLeft f b') s t a b
-> LensLike (AlongsideRight f t) s' t' a' b'
-> LensLike f (s, s') (t, t') (a, a') (b, b')
alongside :: forall (f :: * -> *) b' s t a b s' t' a'.
LensLike (AlongsideLeft f b') s t a b
-> LensLike (AlongsideRight f t) s' t' a' b'
-> LensLike f (s, s') (t, t') (a, a') (b, b')
alongside LensLike (AlongsideLeft f b') s t a b
l1 LensLike (AlongsideRight f t) s' t' a' b'
l2 (a, a') -> f (b, b')
f (s
a1, s'
a2)
= AlongsideRight f t t' -> f (t, t')
forall (f :: * -> *) a b. AlongsideRight f a b -> f (a, b)
getAlongsideRight (AlongsideRight f t t' -> f (t, t'))
-> AlongsideRight f t t' -> f (t, t')
forall a b. (a -> b) -> a -> b
$ LensLike (AlongsideRight f t) s' t' a' b'
l2 LensLike (AlongsideRight f t) s' t' a' b'
-> s' -> (a' -> AlongsideRight f t b') -> AlongsideRight f t t'
forall (f :: * -> *) a b. Functor f => f (a -> b) -> a -> f b
?? s'
a2 ((a' -> AlongsideRight f t b') -> AlongsideRight f t t')
-> (a' -> AlongsideRight f t b') -> AlongsideRight f t t'
forall a b. (a -> b) -> a -> b
$ \a'
b2 -> f (t, b') -> AlongsideRight f t b'
forall (f :: * -> *) a b. f (a, b) -> AlongsideRight f a b
AlongsideRight
(f (t, b') -> AlongsideRight f t b')
-> f (t, b') -> AlongsideRight f t b'
forall a b. (a -> b) -> a -> b
$ AlongsideLeft f b' t -> f (t, b')
forall (f :: * -> *) b a. AlongsideLeft f b a -> f (a, b)
getAlongsideLeft (AlongsideLeft f b' t -> f (t, b'))
-> AlongsideLeft f b' t -> f (t, b')
forall a b. (a -> b) -> a -> b
$ LensLike (AlongsideLeft f b') s t a b
l1 LensLike (AlongsideLeft f b') s t a b
-> s -> (a -> AlongsideLeft f b' b) -> AlongsideLeft f b' t
forall (f :: * -> *) a b. Functor f => f (a -> b) -> a -> f b
?? s
a1 ((a -> AlongsideLeft f b' b) -> AlongsideLeft f b' t)
-> (a -> AlongsideLeft f b' b) -> AlongsideLeft f b' t
forall a b. (a -> b) -> a -> b
$ \a
b1 -> f (b, b') -> AlongsideLeft f b' b
forall (f :: * -> *) b a. f (a, b) -> AlongsideLeft f b a
AlongsideLeft
(f (b, b') -> AlongsideLeft f b' b)
-> f (b, b') -> AlongsideLeft f b' b
forall a b. (a -> b) -> a -> b
$ (a, a') -> f (b, b')
f (a
b1,a'
b2)
{-# INLINE alongside #-}
locus :: IndexedComonadStore p => Lens (p a c s) (p b c s) a b
locus :: forall (p :: * -> * -> * -> *) a c s b.
IndexedComonadStore p =>
Lens (p a c s) (p b c s) a b
locus a -> f b
f p a c s
w = (b -> p a c s -> p b c s
forall b a c t. b -> p a c t -> p b c t
forall (w :: * -> * -> * -> *) b a c t.
IndexedComonadStore w =>
b -> w a c t -> w b c t
`iseek` p a c s
w) (b -> p b c s) -> f b -> f (p b c s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f (p a c s -> a
forall a c t. p a c t -> a
forall (w :: * -> * -> * -> *) a c t.
IndexedComonadStore w =>
w a c t -> a
ipos p a c s
w)
{-# INLINE locus #-}
cloneLens :: ALens s t a b -> Lens s t a b
cloneLens :: forall s t a b. ALens s t a b -> Lens s t a b
cloneLens ALens s t a b
l a -> f b
afb s
s = Pretext (->) a b t
-> forall (f :: * -> *). Functor f => (a -> f b) -> f t
forall (p :: * -> * -> *) a b t.
Pretext p a b t
-> forall (f :: * -> *). Functor f => p a (f b) -> f t
runPretext (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s) a -> f b
afb
{-# INLINE cloneLens #-}
cloneIndexPreservingLens :: ALens s t a b -> IndexPreservingLens s t a b
cloneIndexPreservingLens :: forall s t a b. ALens s t a b -> IndexPreservingLens s t a b
cloneIndexPreservingLens ALens s t a b
l p a (f b)
pafb = (Corep p s -> f t) -> p s (f t)
forall d c. (Corep p d -> c) -> p d c
forall (p :: * -> * -> *) d c.
Corepresentable p =>
(Corep p d -> c) -> p d c
cotabulate ((Corep p s -> f t) -> p s (f t))
-> (Corep p s -> f t) -> p s (f t)
forall a b. (a -> b) -> a -> b
$ \Corep p s
ws -> Pretext (->) a b t
-> forall (f :: * -> *). Functor f => (a -> f b) -> f t
forall (p :: * -> * -> *) a b t.
Pretext p a b t
-> forall (f :: * -> *). Functor f => p a (f b) -> f t
runPretext (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell (Corep p s -> s
forall a. Corep p a -> a
forall (w :: * -> *) a. Comonad w => w a -> a
extract Corep p s
ws)) ((a -> f b) -> f t) -> (a -> f b) -> f t
forall a b. (a -> b) -> a -> b
$ \a
a -> p a (f b) -> Corep p a -> f b
forall a b. p a b -> Corep p a -> b
forall (p :: * -> * -> *) (f :: * -> *) a b.
Cosieve p f =>
p a b -> f a -> b
cosieve p a (f b)
pafb (a
a a -> Corep p s -> Corep p a
forall a b. a -> Corep p b -> Corep p a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Corep p s
ws)
{-# INLINE cloneIndexPreservingLens #-}
cloneIndexedLens :: AnIndexedLens i s t a b -> IndexedLens i s t a b
cloneIndexedLens :: forall i s t a b. AnIndexedLens i s t a b -> IndexedLens i s t a b
cloneIndexedLens AnIndexedLens i s t a b
l p a (f b)
f s
s = Pretext (Indexed i) a b t
-> forall (f :: * -> *). Functor f => Indexed i a (f b) -> f t
forall (p :: * -> * -> *) a b t.
Pretext p a b t
-> forall (f :: * -> *). Functor f => p a (f b) -> f t
runPretext (AnIndexedLens i s t a b
l Indexed i a (Pretext (Indexed i) a b b)
forall a b. Indexed i a (Pretext (Indexed i) a b b)
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s) ((i -> a -> f b) -> Indexed i a (f b)
forall i a b. (i -> a -> b) -> Indexed i a b
Indexed (p a (f b) -> i -> a -> f b
forall a b. p a b -> i -> a -> b
forall i (p :: * -> * -> *) a b.
Indexable i p =>
p a b -> i -> a -> b
indexed p a (f b)
f))
{-# INLINE cloneIndexedLens #-}
(<%~) :: LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
LensLike ((,) b) s t a b
l <%~ :: forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ a -> b
f = LensLike ((,) b) s t a b
l LensLike ((,) b) s t a b -> LensLike ((,) b) s t a b
forall a b. (a -> b) -> a -> b
$ (\b
t -> (b
t, b
t)) (b -> (b, b)) -> (a -> b) -> a -> (b, b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f
{-# INLINE (<%~) #-}
(<+~) :: Num a => LensLike ((,)a) s t a a -> a -> s -> (a, t)
LensLike ((,) a) s t a a
l <+~ :: forall a s t. Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
<+~ a
a = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (a -> a -> a
forall a. Num a => a -> a -> a
+ a
a)
{-# INLINE (<+~) #-}
(<-~) :: Num a => LensLike ((,)a) s t a a -> a -> s -> (a, t)
LensLike ((,) a) s t a a
l <-~ :: forall a s t. Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
<-~ a
a = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ a -> a -> a
forall a. Num a => a -> a -> a
subtract a
a
{-# INLINE (<-~) #-}
(<*~) :: Num a => LensLike ((,)a) s t a a -> a -> s -> (a, t)
LensLike ((,) a) s t a a
l <*~ :: forall a s t. Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
<*~ a
a = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (a -> a -> a
forall a. Num a => a -> a -> a
* a
a)
{-# INLINE (<*~) #-}
(<//~) :: Fractional a => LensLike ((,)a) s t a a -> a -> s -> (a, t)
LensLike ((,) a) s t a a
l <//~ :: forall a s t.
Fractional a =>
LensLike ((,) a) s t a a -> a -> s -> (a, t)
<//~ a
a = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
a)
{-# INLINE (<//~) #-}
(<^~) :: (Num a, Integral e) => LensLike ((,)a) s t a a -> e -> s -> (a, t)
LensLike ((,) a) s t a a
l <^~ :: forall a e s t.
(Num a, Integral e) =>
LensLike ((,) a) s t a a -> e -> s -> (a, t)
<^~ e
e = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (a -> e -> a
forall a b. (Num a, Integral b) => a -> b -> a
^ e
e)
{-# INLINE (<^~) #-}
(<^^~) :: (Fractional a, Integral e) => LensLike ((,)a) s t a a -> e -> s -> (a, t)
LensLike ((,) a) s t a a
l <^^~ :: forall a e s t.
(Fractional a, Integral e) =>
LensLike ((,) a) s t a a -> e -> s -> (a, t)
<^^~ e
e = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (a -> e -> a
forall a b. (Fractional a, Integral b) => a -> b -> a
^^ e
e)
{-# INLINE (<^^~) #-}
(<**~) :: Floating a => LensLike ((,)a) s t a a -> a -> s -> (a, t)
LensLike ((,) a) s t a a
l <**~ :: forall a s t.
Floating a =>
LensLike ((,) a) s t a a -> a -> s -> (a, t)
<**~ a
a = LensLike ((,) a) s t a a
l LensLike ((,) a) s t a a -> (a -> a) -> s -> (a, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (a -> a -> a
forall a. Floating a => a -> a -> a
** a
a)
{-# INLINE (<**~) #-}
(<||~) :: LensLike ((,)Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
LensLike ((,) Bool) s t Bool Bool
l <||~ :: forall s t.
LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
<||~ Bool
b = LensLike ((,) Bool) s t Bool Bool
l LensLike ((,) Bool) s t Bool Bool
-> (Bool -> Bool) -> s -> (Bool, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (Bool -> Bool -> Bool
|| Bool
b)
{-# INLINE (<||~) #-}
(<&&~) :: LensLike ((,)Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
LensLike ((,) Bool) s t Bool Bool
l <&&~ :: forall s t.
LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
<&&~ Bool
b = LensLike ((,) Bool) s t Bool Bool
l LensLike ((,) Bool) s t Bool Bool
-> (Bool -> Bool) -> s -> (Bool, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (Bool -> Bool -> Bool
&& Bool
b)
{-# INLINE (<&&~) #-}
(<<%~) :: LensLike ((,)a) s t a b -> (a -> b) -> s -> (a, t)
<<%~ :: forall a s t b. LensLike ((,) a) s t a b -> (a -> b) -> s -> (a, t)
(<<%~) LensLike ((,) a) s t a b
l = LensLike ((,) a) s t a b
l LensLike ((,) a) s t a b
-> ((a -> b) -> a -> (a, b)) -> (a -> b) -> s -> (a, t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> (a, a)) -> ((a, a) -> (a, b)) -> a -> (a, b)
forall a b c. (a -> b) -> (b -> c) -> a -> c
forall (p :: * -> * -> *) a b c.
Profunctor p =>
(a -> b) -> p b c -> p a c
lmap (\a
a -> (a
a, a
a)) (((a, a) -> (a, b)) -> a -> (a, b))
-> ((a -> b) -> (a, a) -> (a, b)) -> (a -> b) -> a -> (a, b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> (a, a) -> (a, b)
forall a b c. (a -> b) -> (c, a) -> (c, b)
forall (p :: * -> * -> *) a b c.
Strong p =>
p a b -> p (c, a) (c, b)
second'
{-# INLINE (<<%~) #-}
(<<.~) :: LensLike ((,)a) s t a b -> b -> s -> (a, t)
LensLike ((,) a) s t a b
l <<.~ :: forall a s t b. LensLike ((,) a) s t a b -> b -> s -> (a, t)
<<.~ b
b = LensLike ((,) a) s t a b
l LensLike ((,) a) s t a b -> LensLike ((,) a) s t a b
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, b
b)
{-# INLINE (<<.~) #-}
(<<?~) :: LensLike ((,)a) s t a (Maybe b) -> b -> s -> (a, t)
LensLike ((,) a) s t a (Maybe b)
l <<?~ :: forall a s t b.
LensLike ((,) a) s t a (Maybe b) -> b -> s -> (a, t)
<<?~ b
b = LensLike ((,) a) s t a (Maybe b)
l LensLike ((,) a) s t a (Maybe b) -> Maybe b -> s -> (a, t)
forall a s t b. LensLike ((,) a) s t a b -> b -> s -> (a, t)
<<.~ b -> Maybe b
forall a. a -> Maybe a
Just b
b
{-# INLINE (<<?~) #-}
(<<+~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
LensLike' ((,) a) s a
l <<+~ :: forall a s. Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
<<+~ a
b = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> a -> a
forall a. Num a => a -> a -> a
+ a
b)
{-# INLINE (<<+~) #-}
(<<-~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
LensLike' ((,) a) s a
l <<-~ :: forall a s. Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
<<-~ a
b = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> a -> a
forall a. Num a => a -> a -> a
- a
b)
{-# INLINE (<<-~) #-}
(<<*~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
LensLike' ((,) a) s a
l <<*~ :: forall a s. Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
<<*~ a
b = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> a -> a
forall a. Num a => a -> a -> a
* a
b)
{-# INLINE (<<*~) #-}
(<<//~) :: Fractional a => LensLike' ((,) a) s a -> a -> s -> (a, s)
LensLike' ((,) a) s a
l <<//~ :: forall a s.
Fractional a =>
LensLike' ((,) a) s a -> a -> s -> (a, s)
<<//~ a
b = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
b)
{-# INLINE (<<//~) #-}
(<<^~) :: (Num a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s)
LensLike' ((,) a) s a
l <<^~ :: forall a e s.
(Num a, Integral e) =>
LensLike' ((,) a) s a -> e -> s -> (a, s)
<<^~ e
e = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> e -> a
forall a b. (Num a, Integral b) => a -> b -> a
^ e
e)
{-# INLINE (<<^~) #-}
(<<^^~) :: (Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s)
LensLike' ((,) a) s a
l <<^^~ :: forall a e s.
(Fractional a, Integral e) =>
LensLike' ((,) a) s a -> e -> s -> (a, s)
<<^^~ e
e = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> e -> a
forall a b. (Fractional a, Integral b) => a -> b -> a
^^ e
e)
{-# INLINE (<<^^~) #-}
(<<**~) :: Floating a => LensLike' ((,) a) s a -> a -> s -> (a, s)
LensLike' ((,) a) s a
l <<**~ :: forall a s. Floating a => LensLike' ((,) a) s a -> a -> s -> (a, s)
<<**~ a
e = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> LensLike' ((,) a) s a
forall a b. (a -> b) -> a -> b
$ \a
a -> (a
a, a
a a -> a -> a
forall a. Floating a => a -> a -> a
** a
e)
{-# INLINE (<<**~) #-}
(<<||~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
LensLike' ((,) Bool) s Bool
l <<||~ :: forall s. LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
<<||~ Bool
b = LensLike' ((,) Bool) s Bool
l LensLike' ((,) Bool) s Bool -> LensLike' ((,) Bool) s Bool
forall a b. (a -> b) -> a -> b
$ \Bool
a -> (Bool
a, Bool
b Bool -> Bool -> Bool
|| Bool
a)
{-# INLINE (<<||~) #-}
(<<&&~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
LensLike' ((,) Bool) s Bool
l <<&&~ :: forall s. LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
<<&&~ Bool
b = LensLike' ((,) Bool) s Bool
l LensLike' ((,) Bool) s Bool -> LensLike' ((,) Bool) s Bool
forall a b. (a -> b) -> a -> b
$ \Bool
a -> (Bool
a, Bool
b Bool -> Bool -> Bool
&& Bool
a)
{-# INLINE (<<&&~) #-}
(<<<>~) :: Semigroup r => LensLike' ((,) r) s r -> r -> s -> (r, s)
LensLike' ((,) r) s r
l <<<>~ :: forall r s.
Semigroup r =>
LensLike' ((,) r) s r -> r -> s -> (r, s)
<<<>~ r
b = LensLike' ((,) r) s r
l LensLike' ((,) r) s r -> LensLike' ((,) r) s r
forall a b. (a -> b) -> a -> b
$ \r
a -> (r
a, r
a r -> r -> r
forall a. Semigroup a => a -> a -> a
<> r
b)
{-# INLINE (<<<>~) #-}
(<%=) :: MonadState s m => LensLike ((,)b) s s a b -> (a -> b) -> m b
LensLike ((,) b) s s a b
l <%= :: forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= a -> b
f = LensLike ((,) b) s s a b
l LensLike ((,) b) s s a b -> (a -> (b, b)) -> m b
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= (\b
b -> (b
b, b
b)) (b -> (b, b)) -> (a -> b) -> a -> (b, b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f
{-# INLINE (<%=) #-}
(<+=) :: (MonadState s m, Num a) => LensLike' ((,)a) s a -> a -> m a
LensLike' ((,) a) s a
l <+= :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
<+= a
a = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (a -> a -> a
forall a. Num a => a -> a -> a
+ a
a)
{-# INLINE (<+=) #-}
(<-=) :: (MonadState s m, Num a) => LensLike' ((,)a) s a -> a -> m a
LensLike' ((,) a) s a
l <-= :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
<-= a
a = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= a -> a -> a
forall a. Num a => a -> a -> a
subtract a
a
{-# INLINE (<-=) #-}
(<*=) :: (MonadState s m, Num a) => LensLike' ((,)a) s a -> a -> m a
LensLike' ((,) a) s a
l <*= :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
<*= a
a = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (a -> a -> a
forall a. Num a => a -> a -> a
* a
a)
{-# INLINE (<*=) #-}
(<//=) :: (MonadState s m, Fractional a) => LensLike' ((,)a) s a -> a -> m a
LensLike' ((,) a) s a
l <//= :: forall s (m :: * -> *) a.
(MonadState s m, Fractional a) =>
LensLike' ((,) a) s a -> a -> m a
<//= a
a = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
a)
{-# INLINE (<//=) #-}
(<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,)a) s a -> e -> m a
LensLike' ((,) a) s a
l <^= :: forall s (m :: * -> *) a e.
(MonadState s m, Num a, Integral e) =>
LensLike' ((,) a) s a -> e -> m a
<^= e
e = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (a -> e -> a
forall a b. (Num a, Integral b) => a -> b -> a
^ e
e)
{-# INLINE (<^=) #-}
(<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,)a) s a -> e -> m a
LensLike' ((,) a) s a
l <^^= :: forall s (m :: * -> *) a e.
(MonadState s m, Fractional a, Integral e) =>
LensLike' ((,) a) s a -> e -> m a
<^^= e
e = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (a -> e -> a
forall a b. (Fractional a, Integral b) => a -> b -> a
^^ e
e)
{-# INLINE (<^^=) #-}
(<**=) :: (MonadState s m, Floating a) => LensLike' ((,)a) s a -> a -> m a
LensLike' ((,) a) s a
l <**= :: forall s (m :: * -> *) a.
(MonadState s m, Floating a) =>
LensLike' ((,) a) s a -> a -> m a
<**= a
a = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> a) -> m a
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (a -> a -> a
forall a. Floating a => a -> a -> a
** a
a)
{-# INLINE (<**=) #-}
(<||=) :: MonadState s m => LensLike' ((,)Bool) s Bool -> Bool -> m Bool
LensLike' ((,) Bool) s Bool
l <||= :: forall s (m :: * -> *).
MonadState s m =>
LensLike' ((,) Bool) s Bool -> Bool -> m Bool
<||= Bool
b = LensLike' ((,) Bool) s Bool
l LensLike' ((,) Bool) s Bool -> (Bool -> Bool) -> m Bool
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (Bool -> Bool -> Bool
|| Bool
b)
{-# INLINE (<||=) #-}
(<&&=) :: MonadState s m => LensLike' ((,)Bool) s Bool -> Bool -> m Bool
LensLike' ((,) Bool) s Bool
l <&&= :: forall s (m :: * -> *).
MonadState s m =>
LensLike' ((,) Bool) s Bool -> Bool -> m Bool
<&&= Bool
b = LensLike' ((,) Bool) s Bool
l LensLike' ((,) Bool) s Bool -> (Bool -> Bool) -> m Bool
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (Bool -> Bool -> Bool
&& Bool
b)
{-# INLINE (<&&=) #-}
(<<%=) :: (Strong p, MonadState s m) => Over p ((,)a) s s a b -> p a b -> m a
Over p ((,) a) s s a b
l <<%= :: forall (p :: * -> * -> *) s (m :: * -> *) a b.
(Strong p, MonadState s m) =>
Over p ((,) a) s s a b -> p a b -> m a
<<%= p a b
f = Over p ((,) a) s s a b
l Over p ((,) a) s s a b -> p a (a, b) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= (a -> (a, a)) -> p (a, a) (a, b) -> p a (a, b)
forall a b c. (a -> b) -> p b c -> p a c
forall (p :: * -> * -> *) a b c.
Profunctor p =>
(a -> b) -> p b c -> p a c
lmap (\a
a -> (a
a,a
a)) (p a b -> p (a, a) (a, b)
forall a b c. p a b -> p (c, a) (c, b)
forall (p :: * -> * -> *) a b c.
Strong p =>
p a b -> p (c, a) (c, b)
second' p a b
f)
{-# INLINE (<<%=) #-}
(<<.=) :: MonadState s m => LensLike ((,)a) s s a b -> b -> m a
LensLike ((,) a) s s a b
l <<.= :: forall s (m :: * -> *) a b.
MonadState s m =>
LensLike ((,) a) s s a b -> b -> m a
<<.= b
b = LensLike ((,) a) s s a b
l LensLike ((,) a) s s a b -> (a -> (a, b)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a,b
b)
{-# INLINE (<<.=) #-}
(<<?=) :: MonadState s m => LensLike ((,)a) s s a (Maybe b) -> b -> m a
LensLike ((,) a) s s a (Maybe b)
l <<?= :: forall s (m :: * -> *) a b.
MonadState s m =>
LensLike ((,) a) s s a (Maybe b) -> b -> m a
<<?= b
b = LensLike ((,) a) s s a (Maybe b)
l LensLike ((,) a) s s a (Maybe b) -> Maybe b -> m a
forall s (m :: * -> *) a b.
MonadState s m =>
LensLike ((,) a) s s a b -> b -> m a
<<.= b -> Maybe b
forall a. a -> Maybe a
Just b
b
{-# INLINE (<<?=) #-}
(<<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
LensLike' ((,) a) s a
l <<+= :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
<<+= a
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> a -> a
forall a. Num a => a -> a -> a
+ a
n)
{-# INLINE (<<+=) #-}
(<<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
LensLike' ((,) a) s a
l <<-= :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
<<-= a
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> a -> a
forall a. Num a => a -> a -> a
- a
n)
{-# INLINE (<<-=) #-}
(<<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
LensLike' ((,) a) s a
l <<*= :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
<<*= a
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> a -> a
forall a. Num a => a -> a -> a
* a
n)
{-# INLINE (<<*=) #-}
(<<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a
LensLike' ((,) a) s a
l <<//= :: forall s (m :: * -> *) a.
(MonadState s m, Fractional a) =>
LensLike' ((,) a) s a -> a -> m a
<<//= a
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
n)
{-# INLINE (<<//=) #-}
(<<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a
LensLike' ((,) a) s a
l <<^= :: forall s (m :: * -> *) a e.
(MonadState s m, Num a, Integral e) =>
LensLike' ((,) a) s a -> e -> m a
<<^= e
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> e -> a
forall a b. (Num a, Integral b) => a -> b -> a
^ e
n)
{-# INLINE (<<^=) #-}
(<<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a
LensLike' ((,) a) s a
l <<^^= :: forall s (m :: * -> *) a e.
(MonadState s m, Fractional a, Integral e) =>
LensLike' ((,) a) s a -> e -> m a
<<^^= e
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> e -> a
forall a b. (Fractional a, Integral b) => a -> b -> a
^^ e
n)
{-# INLINE (<<^^=) #-}
(<<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a
LensLike' ((,) a) s a
l <<**= :: forall s (m :: * -> *) a.
(MonadState s m, Floating a) =>
LensLike' ((,) a) s a -> a -> m a
<<**= a
n = LensLike' ((,) a) s a
l LensLike' ((,) a) s a -> (a -> (a, a)) -> m a
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \a
a -> (a
a, a
a a -> a -> a
forall a. Floating a => a -> a -> a
** a
n)
{-# INLINE (<<**=) #-}
(<<||=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
LensLike' ((,) Bool) s Bool
l <<||= :: forall s (m :: * -> *).
MonadState s m =>
LensLike' ((,) Bool) s Bool -> Bool -> m Bool
<<||= Bool
b = LensLike' ((,) Bool) s Bool
l LensLike' ((,) Bool) s Bool -> (Bool -> (Bool, Bool)) -> m Bool
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \Bool
a -> (Bool
a, Bool
a Bool -> Bool -> Bool
|| Bool
b)
{-# INLINE (<<||=) #-}
(<<&&=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
LensLike' ((,) Bool) s Bool
l <<&&= :: forall s (m :: * -> *).
MonadState s m =>
LensLike' ((,) Bool) s Bool -> Bool -> m Bool
<<&&= Bool
b = LensLike' ((,) Bool) s Bool
l LensLike' ((,) Bool) s Bool -> (Bool -> (Bool, Bool)) -> m Bool
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \Bool
a -> (Bool
a, Bool
a Bool -> Bool -> Bool
&& Bool
b)
{-# INLINE (<<&&=) #-}
(<<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
LensLike' ((,) r) s r
l <<<>= :: forall s (m :: * -> *) r.
(MonadState s m, Semigroup r) =>
LensLike' ((,) r) s r -> r -> m r
<<<>= r
b = LensLike' ((,) r) s r
l LensLike' ((,) r) s r -> (r -> (r, r)) -> m r
forall {k} s (m :: * -> *) (p :: k -> * -> *) r (a :: k) b.
MonadState s m =>
Over p ((,) r) s s a b -> p a (r, b) -> m r
%%= \r
a -> (r
a, r
a r -> r -> r
forall a. Semigroup a => a -> a -> a
<> r
b)
{-# INLINE (<<<>=) #-}
(<<~) :: MonadState s m => ALens s s a b -> m b -> m b
ALens s s a b
l <<~ :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> m b -> m b
<<~ m b
mb = do
b
b <- m b
mb
(s -> s) -> m ()
forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify ((s -> s) -> m ()) -> (s -> s) -> m ()
forall a b. (a -> b) -> a -> b
$ \s
s -> b -> Pretext (->) a b s -> s
forall c a t. c -> Pretext (->) a c t -> t
forall (w :: * -> * -> * -> *) c a t.
IndexedComonadStore w =>
c -> w a c t -> t
ipeek b
b (ALens s s a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s)
b -> m b
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return b
b
{-# INLINE (<<~) #-}
(<<>~) :: Semigroup m => LensLike ((,)m) s t m m -> m -> s -> (m, t)
LensLike ((,) m) s t m m
l <<>~ :: forall m s t.
Semigroup m =>
LensLike ((,) m) s t m m -> m -> s -> (m, t)
<<>~ m
m = LensLike ((,) m) s t m m
l LensLike ((,) m) s t m m -> (m -> m) -> s -> (m, t)
forall b s t a. LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
<%~ (m -> m -> m
forall a. Semigroup a => a -> a -> a
<> m
m)
{-# INLINE (<<>~) #-}
(<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,)r) s r -> r -> m r
LensLike' ((,) r) s r
l <<>= :: forall s (m :: * -> *) r.
(MonadState s m, Semigroup r) =>
LensLike' ((,) r) s r -> r -> m r
<<>= r
r = LensLike' ((,) r) s r
l LensLike' ((,) r) s r -> (r -> r) -> m r
forall s (m :: * -> *) b a.
MonadState s m =>
LensLike ((,) b) s s a b -> (a -> b) -> m b
<%= (r -> r -> r
forall a. Semigroup a => a -> a -> a
<> r
r)
{-# INLINE (<<>=) #-}
overA :: Arrow ar => LensLike (Context a b) s t a b -> ar a b -> ar s t
overA :: forall (ar :: * -> * -> *) a b s t.
Arrow ar =>
LensLike (Context a b) s t a b -> ar a b -> ar s t
overA LensLike (Context a b) s t a b
l ar a b
p = (s -> (b -> t, a)) -> ar s (b -> t, a)
forall b c. (b -> c) -> ar b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (\s
s -> let (Context b -> t
f a
a) = LensLike (Context a b) s t a b
l a -> Context a b b
forall a b. a -> Context a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s in (b -> t
f, a
a))
ar s (b -> t, a) -> ar (b -> t, a) t -> ar s t
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ar a b -> ar (b -> t, a) (b -> t, b)
forall b c d. ar b c -> ar (d, b) (d, c)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second ar a b
p
ar (b -> t, a) (b -> t, b) -> ar (b -> t, b) t -> ar (b -> t, a) t
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ((b -> t, b) -> t) -> ar (b -> t, b) t
forall b c. (b -> c) -> ar b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (((b -> t) -> b -> t) -> (b -> t, b) -> t
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (b -> t) -> b -> t
forall a. a -> a
id)
(<%@~) :: Over (Indexed i) ((,) b) s t a b -> (i -> a -> b) -> s -> (b, t)
Over (Indexed i) ((,) b) s t a b
l <%@~ :: forall i b s t a.
Over (Indexed i) ((,) b) s t a b -> (i -> a -> b) -> s -> (b, t)
<%@~ i -> a -> b
f = Over (Indexed i) ((,) b) s t a b
l ((i -> a -> (b, b)) -> Indexed i a (b, b)
forall i a b. (i -> a -> b) -> Indexed i a b
Indexed ((i -> a -> (b, b)) -> Indexed i a (b, b))
-> (i -> a -> (b, b)) -> Indexed i a (b, b)
forall a b. (a -> b) -> a -> b
$ \i
i a
a -> let b :: b
b = i -> a -> b
f i
i a
a in (b
b, b
b))
{-# INLINE (<%@~) #-}
(<<%@~) :: Over (Indexed i) ((,) a) s t a b -> (i -> a -> b) -> s -> (a, t)
Over (Indexed i) ((,) a) s t a b
l <<%@~ :: forall i a s t b.
Over (Indexed i) ((,) a) s t a b -> (i -> a -> b) -> s -> (a, t)
<<%@~ i -> a -> b
f = Over (Indexed i) ((,) a) s t a b
l Over (Indexed i) ((,) a) s t a b
-> Over (Indexed i) ((,) a) s t a b
forall a b. (a -> b) -> a -> b
$ (i -> a -> (a, b)) -> Indexed i a (a, b)
forall i a b. (i -> a -> b) -> Indexed i a b
Indexed ((i -> a -> (a, b)) -> Indexed i a (a, b))
-> (i -> a -> (a, b)) -> Indexed i a (a, b)
forall a b. (a -> b) -> a -> b
$ \i
i a
a -> (a -> b) -> (a, a) -> (a, b)
forall a b c. (a -> b) -> (c, a) -> (c, b)
forall (p :: * -> * -> *) a b c.
Strong p =>
p a b -> p (c, a) (c, b)
second' (i -> a -> b
f i
i) (a
a,a
a)
{-# INLINE (<<%@~) #-}
(%%@~) :: Over (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t
%%@~ :: forall {k1} i (f :: k1 -> *) s (t :: k1) a (b :: k1).
Over (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t
(%%@~) Over (Indexed i) f s t a b
l = Over (Indexed i) f s t a b
l Over (Indexed i) f s t a b
-> ((i -> a -> f b) -> Indexed i a (f b))
-> (i -> a -> f b)
-> s
-> f t
forall a b c (q :: * -> * -> *).
Coercible b a =>
(b -> c) -> q a b -> a -> c
forall (p :: * -> * -> *) a b c (q :: * -> * -> *).
(Profunctor p, Coercible b a) =>
p b c -> q a b -> p a c
.# (i -> a -> f b) -> Indexed i a (f b)
forall i a b. (i -> a -> b) -> Indexed i a b
Indexed
{-# INLINE (%%@~) #-}
(%%@=) :: MonadState s m => Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
Over (Indexed i) ((,) r) s s a b
l %%@= :: forall s (m :: * -> *) i r a b.
MonadState s m =>
Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
%%@= i -> a -> (r, b)
f = (s -> (r, s)) -> m r
forall a. (s -> (a, s)) -> m a
forall s (m :: * -> *) a. MonadState s m => (s -> (a, s)) -> m a
State.state (Over (Indexed i) ((,) r) s s a b
l Over (Indexed i) ((,) r) s s a b
-> (i -> a -> (r, b)) -> s -> (r, s)
forall {k1} i (f :: k1 -> *) s (t :: k1) a (b :: k1).
Over (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t
%%@~ i -> a -> (r, b)
f)
{-# INLINE (%%@=) #-}
(<%@=) :: MonadState s m => Over (Indexed i) ((,) b) s s a b -> (i -> a -> b) -> m b
Over (Indexed i) ((,) b) s s a b
l <%@= :: forall s (m :: * -> *) i b a.
MonadState s m =>
Over (Indexed i) ((,) b) s s a b -> (i -> a -> b) -> m b
<%@= i -> a -> b
f = Over (Indexed i) ((,) b) s s a b
l Over (Indexed i) ((,) b) s s a b -> (i -> a -> (b, b)) -> m b
forall s (m :: * -> *) i r a b.
MonadState s m =>
Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
%%@= \ i
i a
a -> let b :: b
b = i -> a -> b
f i
i a
a in (b
b, b
b)
{-# INLINE (<%@=) #-}
(<<%@=) :: MonadState s m => Over (Indexed i) ((,) a) s s a b -> (i -> a -> b) -> m a
Over (Indexed i) ((,) a) s s a b
l <<%@= :: forall s (m :: * -> *) i a b.
MonadState s m =>
Over (Indexed i) ((,) a) s s a b -> (i -> a -> b) -> m a
<<%@= i -> a -> b
f = (s -> (a, s)) -> m a
forall a. (s -> (a, s)) -> m a
forall s (m :: * -> *) a. MonadState s m => (s -> (a, s)) -> m a
State.state (Over (Indexed i) ((,) a) s s a b
l ((i -> a -> (a, b)) -> Indexed i a (a, b)
forall i a b. (i -> a -> b) -> Indexed i a b
Indexed ((i -> a -> (a, b)) -> Indexed i a (a, b))
-> (i -> a -> (a, b)) -> Indexed i a (a, b)
forall a b. (a -> b) -> a -> b
$ \ i
i a
a -> (a
a, i -> a -> b
f i
i a
a)))
{-# INLINE (<<%@=) #-}
(^#) :: s -> ALens s t a b -> a
s
s ^# :: forall s t a b. s -> ALens s t a b -> a
^# ALens s t a b
l = Pretext (->) a b t -> a
forall a c t. Pretext (->) a c t -> a
forall (w :: * -> * -> * -> *) a c t.
IndexedComonadStore w =>
w a c t -> a
ipos (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s)
{-# INLINE (^#) #-}
storing :: ALens s t a b -> b -> s -> t
storing :: forall s t a b. ALens s t a b -> b -> s -> t
storing ALens s t a b
l b
b s
s = b -> Pretext (->) a b t -> t
forall c a t. c -> Pretext (->) a c t -> t
forall (w :: * -> * -> * -> *) c a t.
IndexedComonadStore w =>
c -> w a c t -> t
ipeek b
b (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s)
{-# INLINE storing #-}
(#~) :: ALens s t a b -> b -> s -> t
#~ :: forall s t a b. ALens s t a b -> b -> s -> t
(#~) ALens s t a b
l b
b s
s = b -> Pretext (->) a b t -> t
forall c a t. c -> Pretext (->) a c t -> t
forall (w :: * -> * -> * -> *) c a t.
IndexedComonadStore w =>
c -> w a c t -> t
ipeek b
b (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s)
{-# INLINE (#~) #-}
(#%~) :: ALens s t a b -> (a -> b) -> s -> t
#%~ :: forall s t a b. ALens s t a b -> (a -> b) -> s -> t
(#%~) ALens s t a b
l a -> b
f s
s = (a -> b) -> Pretext (->) a b t -> t
forall a c t. (a -> c) -> Pretext (->) a c t -> t
forall (w :: * -> * -> * -> *) a c t.
IndexedComonadStore w =>
(a -> c) -> w a c t -> t
ipeeks a -> b
f (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s)
{-# INLINE (#%~) #-}
(#%%~) :: Functor f => ALens s t a b -> (a -> f b) -> s -> f t
#%%~ :: forall (f :: * -> *) s t a b.
Functor f =>
ALens s t a b -> (a -> f b) -> s -> f t
(#%%~) ALens s t a b
l a -> f b
f s
s = Pretext (->) a b t
-> forall (f :: * -> *). Functor f => (a -> f b) -> f t
forall (p :: * -> * -> *) a b t.
Pretext p a b t
-> forall (f :: * -> *). Functor f => p a (f b) -> f t
runPretext (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s) a -> f b
f
{-# INLINE (#%%~) #-}
(#=) :: MonadState s m => ALens s s a b -> b -> m ()
ALens s s a b
l #= :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> b -> m ()
#= b
f = (s -> s) -> m ()
forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (ALens s s a b
l ALens s s a b -> b -> s -> s
forall s t a b. ALens s t a b -> b -> s -> t
#~ b
f)
{-# INLINE (#=) #-}
(#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m ()
ALens s s a b
l #%= :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> (a -> b) -> m ()
#%= a -> b
f = (s -> s) -> m ()
forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify (ALens s s a b
l ALens s s a b -> (a -> b) -> s -> s
forall s t a b. ALens s t a b -> (a -> b) -> s -> t
#%~ a -> b
f)
{-# INLINE (#%=) #-}
(<#%~) :: ALens s t a b -> (a -> b) -> s -> (b, t)
ALens s t a b
l <#%~ :: forall s t a b. ALens s t a b -> (a -> b) -> s -> (b, t)
<#%~ a -> b
f = \s
s -> Pretext (->) a b t
-> forall (f :: * -> *). Functor f => (a -> f b) -> f t
forall (p :: * -> * -> *) a b t.
Pretext p a b t
-> forall (f :: * -> *). Functor f => p a (f b) -> f t
runPretext (ALens s t a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s) ((a -> (b, b)) -> (b, t)) -> (a -> (b, b)) -> (b, t)
forall a b. (a -> b) -> a -> b
$ \a
a -> let b :: b
b = a -> b
f a
a in (b
b, b
b)
{-# INLINE (<#%~) #-}
(<#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m b
ALens s s a b
l <#%= :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> (a -> b) -> m b
<#%= a -> b
f = ALens s s a b
l ALens s s a b -> (a -> (b, b)) -> m b
forall s (m :: * -> *) a b r.
MonadState s m =>
ALens s s a b -> (a -> (r, b)) -> m r
#%%= \a
a -> let b :: b
b = a -> b
f a
a in (b
b, b
b)
{-# INLINE (<#%=) #-}
(#%%=) :: MonadState s m => ALens s s a b -> (a -> (r, b)) -> m r
ALens s s a b
l #%%= :: forall s (m :: * -> *) a b r.
MonadState s m =>
ALens s s a b -> (a -> (r, b)) -> m r
#%%= a -> (r, b)
f = (s -> (r, s)) -> m r
forall a. (s -> (a, s)) -> m a
forall s (m :: * -> *) a. MonadState s m => (s -> (a, s)) -> m a
State.state ((s -> (r, s)) -> m r) -> (s -> (r, s)) -> m r
forall a b. (a -> b) -> a -> b
$ \s
s -> Pretext (->) a b s
-> forall (f :: * -> *). Functor f => (a -> f b) -> f s
forall (p :: * -> * -> *) a b t.
Pretext p a b t
-> forall (f :: * -> *). Functor f => p a (f b) -> f t
runPretext (ALens s s a b
l a -> Pretext (->) a b b
forall a b. a -> Pretext (->) a b b
forall (p :: * -> * -> *) (w :: * -> * -> * -> *) a b.
Sellable p w =>
p a (w a b b)
sell s
s) a -> (r, b)
f
{-# INLINE (#%%=) #-}
(<#~) :: ALens s t a b -> b -> s -> (b, t)
ALens s t a b
l <#~ :: forall s t a b. ALens s t a b -> b -> s -> (b, t)
<#~ b
b = \s
s -> (b
b, ALens s t a b -> b -> s -> t
forall s t a b. ALens s t a b -> b -> s -> t
storing ALens s t a b
l b
b s
s)
{-# INLINE (<#~) #-}
(<#=) :: MonadState s m => ALens s s a b -> b -> m b
ALens s s a b
l <#= :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> b -> m b
<#= b
b = do
ALens s s a b
l ALens s s a b -> b -> m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> b -> m ()
#= b
b
b -> m b
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return b
b
{-# INLINE (<#=) #-}
devoid :: Over p f Void Void a b
devoid :: forall {k} (p :: k -> * -> *) (f :: * -> *) (a :: k) b.
Over p f Void Void a b
devoid p a (f b)
_ = Void -> f Void
forall a. Void -> a
absurd
{-# INLINE devoid #-}
united :: Lens' a ()
united :: forall a (f :: * -> *). Functor f => (() -> f ()) -> a -> f a
united () -> f ()
f a
v = () -> f ()
f () f () -> (() -> a) -> f a
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \ () -> a
v
{-# INLINE united #-}
data First1 f a = First1 (f a) a
instance (Functor f) => Functor (First1 f) where
fmap :: forall a b. (a -> b) -> First1 f a -> First1 f b
fmap a -> b
f (First1 f a
fa a
a) = f b -> b -> First1 f b
forall (f :: * -> *) a. f a -> a -> First1 f a
First1 (a -> b
f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f a
fa) (a -> b
f a
a)
{-# INLINE fmap #-}
instance (Functor f) => Apply (First1 f) where
First1 f (a -> b)
ff a -> b
f <.> :: forall a b. First1 f (a -> b) -> First1 f a -> First1 f b
<.> First1 f a
_ a
x = f b -> b -> First1 f b
forall (f :: * -> *) a. f a -> a -> First1 f a
First1 (((a -> b) -> a -> b
forall a b. (a -> b) -> a -> b
$ a
x) ((a -> b) -> b) -> f (a -> b) -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f (a -> b)
ff) (a -> b
f a
x)
{-# INLINE (<.>) #-}
getFirst1 :: First1 f a -> f a
getFirst1 :: forall (f :: * -> *) a. First1 f a -> f a
getFirst1 (First1 f a
fa a
_) = f a
fa
{-# INLINE getFirst1 #-}
head1 :: (Traversable1 t) => Lens' (t a) a
head1 :: forall (t :: * -> *) a. Traversable1 t => Lens' (t a) a
head1 a -> f a
f = First1 f (t a) -> f (t a)
forall (f :: * -> *) a. First1 f a -> f a
getFirst1 (First1 f (t a) -> f (t a))
-> (t a -> First1 f (t a)) -> t a -> f (t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> First1 f a) -> t a -> First1 f (t a)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b. Apply f => (a -> f b) -> t a -> f (t b)
traverse1 (\a
a -> f a -> a -> First1 f a
forall (f :: * -> *) a. f a -> a -> First1 f a
First1 (a -> f a
f a
a) a
a)
{-# INLINE head1 #-}
last1 :: (Traversable1 t) => Lens' (t a) a
last1 :: forall (t :: * -> *) a. Traversable1 t => Lens' (t a) a
last1 a -> f a
f = (Reverse t a -> t a) -> f (Reverse t a) -> f (t a)
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Reverse t a -> t a
forall {k} (f :: k -> *) (a :: k). Reverse f a -> f a
getReverse (f (Reverse t a) -> f (t a))
-> (t a -> f (Reverse t a)) -> t a -> f (t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f a) -> Reverse t a -> f (Reverse t a)
Lens' (Reverse t a) a
forall (t :: * -> *) a. Traversable1 t => Lens' (t a) a
head1 a -> f a
f (Reverse t a -> f (Reverse t a))
-> (t a -> Reverse t a) -> t a -> f (Reverse t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t a -> Reverse t a
forall {k} (f :: k -> *) (a :: k). f a -> Reverse f a
Reverse
{-# INLINE last1 #-}
fusing :: Functor f => LensLike (Yoneda f) s t a b -> LensLike f s t a b
fusing :: forall (f :: * -> *) s t a b.
Functor f =>
LensLike (Yoneda f) s t a b -> LensLike f s t a b
fusing LensLike (Yoneda f) s t a b
t = \a -> f b
f -> Yoneda f t -> f t
forall (f :: * -> *) a. Yoneda f a -> f a
lowerYoneda (Yoneda f t -> f t) -> (s -> Yoneda f t) -> s -> f t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LensLike (Yoneda f) s t a b
t (f b -> Yoneda f b
forall (f :: * -> *) a. Functor f => f a -> Yoneda f a
liftYoneda (f b -> Yoneda f b) -> (a -> f b) -> a -> Yoneda f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> f b
f)
{-# INLINE fusing #-}