-- | This module contains lenses, prisms, grids, grates and traversals for common structures in Haskell.
-- It also contains the combinators for various kinds of optics.
--
-- A Function name with @'@ is a grate variant of a grid, and a function name with @_@ is a traversal variants of a grid or prism.
-- For example, 'both'' is the grate variant of 'both' while 'both_' is the traversal variant.
module Lens.Family.Stock (
-- * Stock Lenses
    _1, _2
  , chosen
  , ix
  , at, intAt
  , at', intAt'
  , contains, intContains
-- * Stock Prisms
  , left, right
  , just, nothing
-- * Stock Grids
  , both
  , bend, lend
-- * Stock Grates
  , cod
  , both'
  , bend', lend'
-- * Stock Traversals
  , both_
  , bend_, lend_
  , left_, right_
  , just_, nothing_
  , ignored
-- * Stock SECs
  , mapped
-- * Lens Combinators
  , alongside
  , backwards
  , beside, beside', beside_
  , choosing
  , from
-- * Types
  , AlongsideLeft, AlongsideRight
  , FromF, FromG
-- * Re-exports
  , AdapterLike, AdapterLike'
  , LensLike, LensLike'
  , GrateLike, GrateLike'
  , Identical, Backwards
  , FiniteBits
-- * Deprecated names
  , lft, rgt
  , some, none
  , lft_, rgt_
  , some_, none_
  ) where

import Control.Arrow (first, second)
import Control.Applicative.Backwards (Backwards(..))
import Control.Applicative (liftA2)
import Data.Bits (FiniteBits, (.|.), bit, finiteBitSize, testBit, zeroBits)
import qualified Data.IntMap as IntMap
import qualified Data.IntMap.Strict as IntMap'
import qualified Data.IntSet as IntSet
import qualified Data.Map as Map
import qualified Data.Map.Strict as Map'
import Data.Proxy (asProxyTypeOf)
import qualified Data.Set as Set
import Lens.Family
import Lens.Family.Phantom
import Lens.Family.Unchecked

choosing :: Functor f => LensLike f s0 t0 a b -> LensLike f s1 t1 a b -> LensLike f (Either s0 s1) (Either t0 t1) a b
-- ^ @
-- choosing :: Lens s0 t0 a b -> Lens s1 t1 a b -> Lens (Either s0 s1) (Either t0 t1) a b
-- @
--
-- @
-- choosing :: Traversal s0 t0 a b -> Traversal s1 t1 a b -> Traversal (Either s0 s1) (Either t0 t1) a b
-- @
--
-- @
-- choosing :: Getter s0 t0 a b -> Getter s1 t1 a b -> Getter (Either s0 s1) (Either t0 t1) a b
-- @
--
-- @
-- choosing :: Fold s0 t0 a b -> Fold s1 t1 a b -> Fold (Either s0 s1) (Either t0 t1) a b
-- @
--
-- @
-- choosing :: Setter s0 t0 a b -> Setter s1 t1 a b -> Setter (Either s0 s1) (Either t0 t1) a b
-- @
--
-- Given two lens\/traversal\/getter\/fold\/setter families with the same substructure, make a new lens\/traversal\/getter\/fold\/setter on 'Either'.
choosing :: LensLike f s0 t0 a b
-> LensLike f s1 t1 a b
-> LensLike f (Either s0 s1) (Either t0 t1) a b
choosing LensLike f s0 t0 a b
la LensLike f s1 t1 a b
_  a -> f b
f (Left s0
a)  = t0 -> Either t0 t1
forall a b. a -> Either a b
Left  (t0 -> Either t0 t1) -> f t0 -> f (Either t0 t1)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f s0 t0 a b
la a -> f b
f s0
a
choosing LensLike f s0 t0 a b
_  LensLike f s1 t1 a b
lb a -> f b
f (Right s1
b) = t1 -> Either t0 t1
forall a b. b -> Either a b
Right (t1 -> Either t0 t1) -> f t1 -> f (Either t0 t1)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f s1 t1 a b
lb a -> f b
f s1
b

_1 :: Functor f => LensLike f (a, r) (b, r) a b
-- ^ @
-- _1 :: Lens (a, r) (b, r) a b
-- @
--
-- Lens on the first element of a pair.
_1 :: LensLike f (a, r) (b, r) a b
_1 a -> f b
f (a
a, r
r) = (\b
b -> (b
b, r
r)) (b -> (b, r)) -> f b -> f (b, r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a

_2 :: Functor f => LensLike f (r, a) (r, b) a b
-- ^ @
-- _2 :: Lens (r, a) (r, b) a b
-- @
--
-- Lens on the second element of a pair.
_2 :: LensLike f (r, a) (r, b) a b
_2 a -> f b
f (r
r, a
a) = (\b
b -> (r
r, b
b)) (b -> (r, b)) -> f b -> f (r, b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a

chosen :: Functor f => LensLike f (Either a a) (Either b b) a b
-- ^ @
-- chosen :: Lens (Either a a) (Either b b) a b
-- @
--
-- Lens on the Left or Right element of an ('Either' a a).
chosen :: LensLike f (Either a a) (Either b b) a b
chosen = LensLike f a b a b
-> LensLike f a b a b -> LensLike f (Either a a) (Either b b) a b
forall (f :: * -> *) s0 t0 a b s1 t1.
Functor f =>
LensLike f s0 t0 a b
-> LensLike f s1 t1 a b
-> LensLike f (Either s0 s1) (Either t0 t1) a b
choosing LensLike f a b a b
forall a. a -> a
id LensLike f a b a b
forall a. a -> a
id

ix :: (Eq k, Functor f) => k -> LensLike' f (k -> v) v
-- ^ @
-- ix :: Eq k => k -> Lens' (k -> v) v
-- @
--
-- Lens on a given point of a function.
ix :: k -> LensLike' f (k -> v) v
ix k
k v -> f v
f k -> v
g = (\v
v' k
x -> if (k
k k -> k -> Bool
forall a. Eq a => a -> a -> Bool
== k
x) then v
v' else k -> v
g k
x) (v -> k -> v) -> f v -> f (k -> v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> v -> f v
f (k -> v
g k
k)

at :: (Ord k, Functor f) => k -> LensLike' f (Map.Map k v) (Maybe v)
-- ^ @
-- at :: Ord k => k -> Lens' (Map.Map k v) (Maybe v)
-- @
--
-- Lens on a given point of a 'Map.Map'.
at :: k -> LensLike' f (Map k v) (Maybe v)
at = ((Maybe v -> f (Maybe v)) -> k -> Map k v -> f (Map k v))
-> k -> LensLike' f (Map k v) (Maybe v)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Maybe v -> f (Maybe v)) -> k -> Map k v -> f (Map k v)
forall (f :: * -> *) k a.
(Functor f, Ord k) =>
(Maybe a -> f (Maybe a)) -> k -> Map k a -> f (Map k a)
Map.alterF

intAt :: Functor f => Int -> LensLike' f (IntMap.IntMap v) (Maybe v)
-- ^ @
-- intAt :: Int -> Lens (IntMap.IntMap v) (Maybe v)
-- @
--
-- Lens on a given point of a 'IntMap.IntMap'.
intAt :: Int -> LensLike' f (IntMap v) (Maybe v)
intAt = ((Maybe v -> f (Maybe v)) -> Int -> IntMap v -> f (IntMap v))
-> Int -> LensLike' f (IntMap v) (Maybe v)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Maybe v -> f (Maybe v)) -> Int -> IntMap v -> f (IntMap v)
forall (f :: * -> *) a.
Functor f =>
(Maybe a -> f (Maybe a)) -> Int -> IntMap a -> f (IntMap a)
IntMap.alterF

at' :: (Ord k, Functor f) => k -> LensLike' f (Map.Map k v) (Maybe v)
-- ^ @
-- at :: Ord k => k -> Lens' (Map.Map k v) (Maybe v)
-- @
--
-- Lens providing strict access to a given point of a 'Map.Map'.
at' :: k -> LensLike' f (Map k v) (Maybe v)
at' = ((Maybe v -> f (Maybe v)) -> k -> Map k v -> f (Map k v))
-> k -> LensLike' f (Map k v) (Maybe v)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Maybe v -> f (Maybe v)) -> k -> Map k v -> f (Map k v)
forall (f :: * -> *) k a.
(Functor f, Ord k) =>
(Maybe a -> f (Maybe a)) -> k -> Map k a -> f (Map k a)
Map'.alterF

intAt' :: Functor f => Int -> LensLike' f (IntMap.IntMap v) (Maybe v)
-- ^ @
-- intAt :: Int -> Lens (IntMap.IntMap v) (Maybe v)
-- @
--
-- Lens providing strict access to a given point of a 'IntMap.IntMap'.
intAt' :: Int -> LensLike' f (IntMap v) (Maybe v)
intAt' = ((Maybe v -> f (Maybe v)) -> Int -> IntMap v -> f (IntMap v))
-> Int -> LensLike' f (IntMap v) (Maybe v)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Maybe v -> f (Maybe v)) -> Int -> IntMap v -> f (IntMap v)
forall (f :: * -> *) a.
Functor f =>
(Maybe a -> f (Maybe a)) -> Int -> IntMap a -> f (IntMap a)
IntMap'.alterF

contains :: (Ord k, Functor f) => k -> LensLike' f (Set.Set k) Bool
-- ^ @
-- contains :: Ord => k -> Lens' (Set.Set k) Bool
-- @
--
-- Lens on a given point of a 'Set.Set'.
contains :: k -> LensLike' f (Set k) Bool
contains k
k = (Set k -> Bool)
-> (Set k -> Bool -> Set k) -> LensLike' f (Set k) Bool
forall (f :: * -> *) s a b t.
Functor f =>
(s -> a) -> (s -> b -> t) -> LensLike f s t a b
lens (k -> Set k -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.member k
k) (\Set k
m Bool
nv -> if Bool
nv then k -> Set k -> Set k
forall a. Ord a => a -> Set a -> Set a
Set.insert k
k Set k
m else k -> Set k -> Set k
forall a. Ord a => a -> Set a -> Set a
Set.delete k
k Set k
m)

intContains :: Functor f => Int -> LensLike' f IntSet.IntSet Bool
-- ^ @
-- intContains :: Int -> Lens' IntSet.IntSet Bool
-- @
--
-- Lens on a given point of a 'IntSet.IntSet'.
intContains :: Int -> LensLike' f IntSet Bool
intContains Int
k = (IntSet -> Bool)
-> (IntSet -> Bool -> IntSet) -> LensLike' f IntSet Bool
forall (f :: * -> *) s a b t.
Functor f =>
(s -> a) -> (s -> b -> t) -> LensLike f s t a b
lens (Int -> IntSet -> Bool
IntSet.member Int
k) (\IntSet
m Bool
nv -> if Bool
nv then Int -> IntSet -> IntSet
IntSet.insert Int
k IntSet
m else Int -> IntSet -> IntSet
IntSet.delete Int
k IntSet
m)

cod :: Functor g => GrateLike g (r -> a) (r -> b) a b
-- ^ @
-- cod :: Grate (r -> a) (r -> b) a b
-- @
--
-- A grate accessing the codomain of a function.
cod :: GrateLike g (r -> a) (r -> b) a b
cod g a -> b
f g (r -> a)
h r
r = g a -> b
f (g a -> b) -> g a -> b
forall a b. (a -> b) -> a -> b
$ ((r -> a) -> r -> a
forall a b. (a -> b) -> a -> b
$ r
r) ((r -> a) -> a) -> g (r -> a) -> g a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g (r -> a)
h

left :: (Applicative f, Traversable g) => AdapterLike f g (Either a r) (Either b r) a b
-- ^ @
-- left :: Prism (Either a r) (Either b r) a b
-- @
--
-- A prism on the 'Left' element of an 'Either'.
left :: AdapterLike f g (Either a r) (Either b r) a b
left g a -> f b
f = (r -> f (Either b r))
-> (g a -> f (Either b r)) -> Either r (g a) -> f (Either b r)
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Either b r -> f (Either b r)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either b r -> f (Either b r))
-> (r -> Either b r) -> r -> f (Either b r)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. r -> Either b r
forall a b. b -> Either a b
Right) ((b -> Either b r) -> f b -> f (Either b r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap b -> Either b r
forall a b. a -> Either a b
Left (f b -> f (Either b r)) -> (g a -> f b) -> g a -> f (Either b r)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g a -> f b
f) (Either r (g a) -> f (Either b r))
-> (g (Either a r) -> Either r (g a))
-> g (Either a r)
-> f (Either b r)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Either a r -> Either r a) -> g (Either a r) -> Either r (g a)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Either a r -> Either r a
forall b a. Either b a -> Either a b
switch
 where
  switch :: Either b a -> Either a b
switch = (b -> Either a b) -> (a -> Either a b) -> Either b a -> Either a b
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either b -> Either a b
forall a b. b -> Either a b
Right a -> Either a b
forall a b. a -> Either a b
Left

left_ :: Applicative f => LensLike f (Either a r) (Either b r) a b
-- ^ @
-- left_ :: Traversal (Either a r) (Either b r) a b
-- @
--
-- Traversal on the 'Left' element of an 'Either'.
--
-- @
-- left_ = under left
-- @
left_ :: LensLike f (Either a r) (Either b r) a b
left_ = AResetter (Either a r) (f (Either b r)) a (f b)
-> LensLike f (Either a r) (Either b r) a b
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under AResetter (Either a r) (f (Either b r)) a (f b)
forall (f :: * -> *) (g :: * -> *) a r b.
(Applicative f, Traversable g) =>
AdapterLike f g (Either a r) (Either b r) a b
left

right :: (Applicative f, Traversable g) => AdapterLike f g (Either r a) (Either r b) a b
-- ^ @
-- right :: Prism (Either r a) (Either r b) a b
-- @
--
-- A prism on the 'Right' element of an 'Either'.
right :: AdapterLike f g (Either r a) (Either r b) a b
right g a -> f b
f = (r -> f (Either r b))
-> (g a -> f (Either r b)) -> Either r (g a) -> f (Either r b)
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Either r b -> f (Either r b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either r b -> f (Either r b))
-> (r -> Either r b) -> r -> f (Either r b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. r -> Either r b
forall a b. a -> Either a b
Left) ((b -> Either r b) -> f b -> f (Either r b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap b -> Either r b
forall a b. b -> Either a b
Right (f b -> f (Either r b)) -> (g a -> f b) -> g a -> f (Either r b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g a -> f b
f) (Either r (g a) -> f (Either r b))
-> (g (Either r a) -> Either r (g a))
-> g (Either r a)
-> f (Either r b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g (Either r a) -> Either r (g a)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA

right_ :: Applicative f => LensLike f (Either r a) (Either r b) a b
-- ^ @
-- right_ :: Traversal (Either r a) (Either r b) a b
-- @
--
-- Traversal on the 'Right' element of an 'Either'.
--
-- @
-- right_ = under right
-- @
right_ :: LensLike f (Either r a) (Either r b) a b
right_ = AResetter (Either r a) (f (Either r b)) a (f b)
-> LensLike f (Either r a) (Either r b) a b
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under AResetter (Either r a) (f (Either r b)) a (f b)
forall (f :: * -> *) (g :: * -> *) r a b.
(Applicative f, Traversable g) =>
AdapterLike f g (Either r a) (Either r b) a b
right

just :: (Applicative f, Traversable g) => AdapterLike f g (Maybe a) (Maybe b) a b
-- ^ @
-- just :: Prism (Maybe a) (Maybe b) a b
-- @
--
-- A prism on the 'Just' element of a 'Maybe'.
just :: AdapterLike f g (Maybe a) (Maybe b) a b
just g a -> f b
f = f (Maybe b) -> (g a -> f (Maybe b)) -> Maybe (g a) -> f (Maybe b)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Maybe b -> f (Maybe b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe b
forall a. Maybe a
Nothing) ((b -> Maybe b) -> f b -> f (Maybe b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap b -> Maybe b
forall a. a -> Maybe a
Just (f b -> f (Maybe b)) -> (g a -> f b) -> g a -> f (Maybe b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g a -> f b
f) (Maybe (g a) -> f (Maybe b))
-> (g (Maybe a) -> Maybe (g a)) -> g (Maybe a) -> f (Maybe b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g (Maybe a) -> Maybe (g a)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA

just_ :: Applicative f => LensLike f (Maybe a) (Maybe b) a b
-- ^ @
-- just_ :: Traversal (Maybe a) (Maybe b) a b
-- @
--
-- Traversal on the 'Just' element of a 'Maybe'.
just_ :: LensLike f (Maybe a) (Maybe b) a b
just_ = AResetter (Maybe a) (f (Maybe b)) a (f b)
-> LensLike f (Maybe a) (Maybe b) a b
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under AResetter (Maybe a) (f (Maybe b)) a (f b)
forall (f :: * -> *) (g :: * -> *) a b.
(Applicative f, Traversable g) =>
AdapterLike f g (Maybe a) (Maybe b) a b
just

nothing :: (Applicative f, Traversable g) => AdapterLike' f g (Maybe a) ()
-- ^ @
-- nothing :: Prism' (Maybe a) ()
-- @
--
-- A prism on the 'Nothing' element of a 'Maybe'.
nothing :: AdapterLike' f g (Maybe a) ()
nothing = (Maybe a -> Either (Maybe a) ())
-> (() -> Maybe a) -> AdapterLike' f g (Maybe a) ()
forall (f :: * -> *) (g :: * -> *) s t a b.
(Applicative f, Traversable g) =>
(s -> Either t a) -> (b -> t) -> AdapterLike f g s t a b
prism (Either (Maybe a) ()
-> (a -> Either (Maybe a) ()) -> Maybe a -> Either (Maybe a) ()
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (() -> Either (Maybe a) ()
forall a b. b -> Either a b
Right ()) (Maybe a -> Either (Maybe a) ()
forall a b. a -> Either a b
Left (Maybe a -> Either (Maybe a) ())
-> (a -> Maybe a) -> a -> Either (Maybe a) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Maybe a
forall a. a -> Maybe a
Just)) (Maybe a -> () -> Maybe a
forall a b. a -> b -> a
const Maybe a
forall a. Maybe a
Nothing)

nothing_ :: Applicative f => LensLike' f (Maybe a) ()
-- ^ @
-- nothing_ :: Traversal' (Maybe a) ()
-- @
--
-- Traversal on the 'Nothing' element of a 'Maybe'.
nothing_ :: LensLike' f (Maybe a) ()
nothing_ = AResetter (Maybe a) (f (Maybe a)) () (f ())
-> LensLike' f (Maybe a) ()
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under AResetter (Maybe a) (f (Maybe a)) () (f ())
forall (f :: * -> *) (g :: * -> *) a.
(Applicative f, Traversable g) =>
AdapterLike' f g (Maybe a) ()
nothing

both :: (Applicative f, Functor g) => AdapterLike f g (a,a) (b,b) a b
-- ^ @
-- both :: Grid (a,a) (b,b) a b
-- @
--
-- A grid on both elements of a pair @(a,a)@.
both :: AdapterLike f g (a, a) (b, b) a b
both = AdapterLike f g a b a b
-> AdapterLike f g a b a b -> AdapterLike f g (a, a) (b, b) a b
forall (f :: * -> *) (g :: * -> *) s0 t0 a b s1 t1.
(Applicative f, Functor g) =>
AdapterLike f g s0 t0 a b
-> AdapterLike f g s1 t1 a b
-> AdapterLike f g (s0, s1) (t0, t1) a b
beside AdapterLike f g a b a b
forall a. a -> a
id AdapterLike f g a b a b
forall a. a -> a
id

both' :: Functor g => GrateLike g (a,a) (b,b) a b
-- ^ @
-- both' :: Grate (a,a) (b,b) a b
-- @
--
-- A grate on both elements of a pair @(a,a)@.
--
-- @
-- both' = over both
-- @
both' :: GrateLike g (a, a) (b, b) a b
both' = GrateLike g a b a b
-> GrateLike g a b a b -> GrateLike g (a, a) (b, b) a b
forall (g :: * -> *) s0 t0 a b s1 t1.
Functor g =>
GrateLike g s0 t0 a b
-> GrateLike g s1 t1 a b -> GrateLike g (s0, s1) (t0, t1) a b
beside' GrateLike g a b a b
forall a. a -> a
id GrateLike g a b a b
forall a. a -> a
id

both_ :: Applicative f => LensLike f (a,a) (b,b) a b
-- ^ @
-- both_ :: Traversal (a,a) (b,b) a b
-- @
--
-- Traversals on both elements of a pair @(a,a)@.
--
-- @
-- both_ = under both
-- @
both_ :: LensLike f (a, a) (b, b) a b
both_ = LensLike f a b a b
-> LensLike f a b a b -> LensLike f (a, a) (b, b) a b
forall (f :: * -> *) s0 t0 a b s1 t1.
Applicative f =>
LensLike f s0 t0 a b
-> LensLike f s1 t1 a b -> LensLike f (s0, s1) (t0, t1) a b
beside_ LensLike f a b a b
forall a. a -> a
id LensLike f a b a b
forall a. a -> a
id

lend :: (FiniteBits b, Applicative f, Functor g) => AdapterLike' f g b Bool
-- ^ @
-- lend :: FiniteBits b => Grid' b Bool
-- @
--
-- A grid from the least significant bit to the most significant bit of a 'FiniteBits' type.
--
-- Little endian order.
lend :: AdapterLike' f g b Bool
lend g Bool -> f Bool
f g b
s = (f b -> f b -> f b) -> f b -> [f b] -> f b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ((b -> b -> b) -> f b -> f b -> f b
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 b -> b -> b
forall a. Bits a => a -> a -> a
(.|.)) (b -> f b
forall (f :: * -> *) a. Applicative f => a -> f a
pure b
forall a. Bits a => a
zeroBits) [Int -> Bool -> b
forall p. Bits p => Int -> Bool -> p
mask Int
i (Bool -> b) -> f Bool -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g Bool -> f Bool
f ((b -> Int -> Bool) -> Int -> b -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip b -> Int -> Bool
forall a. Bits a => a -> Int -> Bool
testBit Int
i (b -> Bool) -> g b -> g Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g b
s) | Int
i <- [Int
0..b -> Int
forall b. FiniteBits b => b -> Int
finiteBitSize b
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1]]
 where
  mask :: Int -> Bool -> p
mask Int
i Bool
True = Int -> p
forall a. Bits a => Int -> a
bit Int
i
  mask Int
_ Bool
False = p
forall a. Bits a => a
zeroBits
  b :: b
b = b
b b -> g b -> b
forall a (proxy :: * -> *). a -> proxy a -> a
`asProxyTypeOf` g b
s

lend' :: (FiniteBits b, Functor g) => GrateLike' g b Bool
-- ^ @
-- lend' :: FiniteBits b => Grate' b Bool
-- @
--
-- A grate from the least significant bit to the most significant bit of a 'FiniteBits' type.
--
-- Little endian order.
--
-- @
-- lend' = over lend
-- @
lend' :: GrateLike' g b Bool
lend' = ASetter (g b) b (g Bool) Bool -> GrateLike' g b Bool
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over ASetter (g b) b (g Bool) Bool
forall b (f :: * -> *) (g :: * -> *).
(FiniteBits b, Applicative f, Functor g) =>
AdapterLike' f g b Bool
lend

lend_ :: (FiniteBits b, Applicative f) => LensLike' f b Bool
-- ^ @
-- lend_ :: FiniteBits b => Traversal' b Bool
-- @
--
-- A traversal from the least significant bit to the most significant bit of a 'FiniteBits' type.
--
-- Little endian order.
--
-- @
-- lend_ = under lend
-- @
lend_ :: LensLike' f b Bool
lend_ = AResetter b (f b) Bool (f Bool) -> LensLike' f b Bool
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under AResetter b (f b) Bool (f Bool)
forall b (f :: * -> *) (g :: * -> *).
(FiniteBits b, Applicative f, Functor g) =>
AdapterLike' f g b Bool
lend

bend :: (FiniteBits b, Applicative f, Functor g) => AdapterLike' f g b Bool
-- ^ @
-- bend :: FiniteBits b => Grid' b Bool
-- @
--
-- A grid from the most significant bit to the least significant bit of a 'FiniteBits' type.
--
-- Big endian order.
bend :: AdapterLike' f g b Bool
bend = LensLike (Backwards f) (g b) b (g Bool) Bool
-> AdapterLike' f g b Bool
forall (f :: * -> *) s t a b.
LensLike (Backwards f) s t a b -> LensLike f s t a b
backwards LensLike (Backwards f) (g b) b (g Bool) Bool
forall b (f :: * -> *) (g :: * -> *).
(FiniteBits b, Applicative f, Functor g) =>
AdapterLike' f g b Bool
lend

bend' :: (FiniteBits b, Functor g) => GrateLike' g b Bool
-- ^ @
-- bend' :: FiniteBits b => Grate' b Bool
-- @
--
-- A grate from the most significant bit to the least significant bit of a 'FiniteBits' type.
--
-- Big endian order.
--
-- @
-- bend' = over bend
-- @
bend' :: GrateLike' g b Bool
bend' = ASetter (g b) b (g Bool) Bool -> GrateLike' g b Bool
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over ASetter (g b) b (g Bool) Bool
forall b (f :: * -> *) (g :: * -> *).
(FiniteBits b, Applicative f, Functor g) =>
AdapterLike' f g b Bool
bend

bend_ :: (FiniteBits b, Applicative f) => LensLike' f b Bool
-- ^ @
-- bend_ :: FiniteBits b => Traversal' b Bool
-- @
--
-- A traversal from the most significant bit to the least significant bit of a 'FiniteBits' type.
--
-- Big endian order.
--
-- @
-- bend_ = under bend
-- @
bend_ :: LensLike' f b Bool
bend_ = AResetter b (f b) Bool (f Bool) -> LensLike' f b Bool
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under AResetter b (f b) Bool (f Bool)
forall b (f :: * -> *) (g :: * -> *).
(FiniteBits b, Applicative f, Functor g) =>
AdapterLike' f g b Bool
bend

beside :: (Applicative f, Functor g) => AdapterLike f g s0 t0 a b -> AdapterLike f g s1 t1 a b -> AdapterLike f g (s0, s1) (t0, t1) a b
-- ^ @
-- beside :: Grid s1 t1 a b -> Grid s2 t2 a b -> Grid (s1, s2) (t1, t2) a b
-- @
--
-- Given two grids referencing a type 'c', create a grid on the pair referencing 'c'.
beside :: AdapterLike f g s0 t0 a b
-> AdapterLike f g s1 t1 a b
-> AdapterLike f g (s0, s1) (t0, t1) a b
beside AdapterLike f g s0 t0 a b
la AdapterLike f g s1 t1 a b
lb g a -> f b
f g (s0, s1)
s = (,) (t0 -> t1 -> (t0, t1)) -> f t0 -> f (t1 -> (t0, t1))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AdapterLike f g s0 t0 a b
la g a -> f b
f ((s0, s1) -> s0
forall a b. (a, b) -> a
fst ((s0, s1) -> s0) -> g (s0, s1) -> g s0
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g (s0, s1)
s) f (t1 -> (t0, t1)) -> f t1 -> f (t0, t1)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AdapterLike f g s1 t1 a b
lb g a -> f b
f ((s0, s1) -> s1
forall a b. (a, b) -> b
snd ((s0, s1) -> s1) -> g (s0, s1) -> g s1
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g (s0, s1)
s)

beside' :: Functor g => GrateLike g s0 t0 a b -> GrateLike g s1 t1 a b -> GrateLike g (s0, s1) (t0, t1) a b
-- ^ @
-- beside' :: Grate s0 t0 a b -> Grate s1 t1 a b -> Grate (s0, s1) (t0, t1) a b
-- @
--
-- @
-- beside' :: Resetter s0 t0 a b -> Resetter s1 t1 a b -> Resetter (s0, s1) (t0, t1) a b
-- @
--
-- Given two grates\/resetters referencing a type 'c', create a grate\/resetter on the pair referencing 'c'.
beside' :: GrateLike g s0 t0 a b
-> GrateLike g s1 t1 a b -> GrateLike g (s0, s1) (t0, t1) a b
beside' GrateLike g s0 t0 a b
la GrateLike g s1 t1 a b
lb = ASetter (g (s0, s1)) (t0, t1) (g a) b
-> GrateLike g (s0, s1) (t0, t1) a b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over (ASetter (g (s0, s1)) (t0, t1) (g a) b
 -> GrateLike g (s0, s1) (t0, t1) a b)
-> ASetter (g (s0, s1)) (t0, t1) (g a) b
-> GrateLike g (s0, s1) (t0, t1) a b
forall a b. (a -> b) -> a -> b
$ AdapterLike Identity g s0 t0 a b
-> AdapterLike Identity g s1 t1 a b
-> ASetter (g (s0, s1)) (t0, t1) (g a) b
forall (f :: * -> *) (g :: * -> *) s0 t0 a b s1 t1.
(Applicative f, Functor g) =>
AdapterLike f g s0 t0 a b
-> AdapterLike f g s1 t1 a b
-> AdapterLike f g (s0, s1) (t0, t1) a b
beside (GrateLike g s0 t0 a b -> AdapterLike Identity g s0 t0 a b
forall (f :: * -> *) a b s t.
Identical f =>
((a -> b) -> s -> t) -> LensLike f s t a b
setting GrateLike g s0 t0 a b
la) (GrateLike g s1 t1 a b -> AdapterLike Identity g s1 t1 a b
forall (f :: * -> *) a b s t.
Identical f =>
((a -> b) -> s -> t) -> LensLike f s t a b
setting GrateLike g s1 t1 a b
lb)

beside_ :: Applicative f => LensLike f s0 t0 a b -> LensLike f s1 t1 a b -> LensLike f (s0, s1) (t0, t1) a b
-- ^ @
-- beside_ :: Traversal s0 t0 a b -> Traversal s1 t1 a b -> Traversal (s0, s1) (t0, t1) a b
-- @
--
-- @
-- beside_ :: Fold s0 t0 a b -> Fold s1 t1 a b -> Fold (s0, s1) (t0, t1) a b
-- @
--
-- @
-- beside_ :: Setter s0 t0 a b -> Setter s1 t1 a b -> Setter (s0, s1) (t0, t1) a b
-- @
--
-- Given two traversals\/folds\/setters referencing a type 'c', create a traversal\/fold\/setter on the pair referencing 'c'.
beside_ :: LensLike f s0 t0 a b
-> LensLike f s1 t1 a b -> LensLike f (s0, s1) (t0, t1) a b
beside_ LensLike f s0 t0 a b
la LensLike f s1 t1 a b
lb = AResetter (s0, s1) (f (t0, t1)) a (f b)
-> LensLike f (s0, s1) (t0, t1) a b
forall s t a b. AResetter s t a b -> (a -> b) -> s -> t
under (AResetter (s0, s1) (f (t0, t1)) a (f b)
 -> LensLike f (s0, s1) (t0, t1) a b)
-> AResetter (s0, s1) (f (t0, t1)) a (f b)
-> LensLike f (s0, s1) (t0, t1) a b
forall a b. (a -> b) -> a -> b
$ AdapterLike f Identity s0 t0 a b
-> AdapterLike f Identity s1 t1 a b
-> AResetter (s0, s1) (f (t0, t1)) a (f b)
forall (f :: * -> *) (g :: * -> *) s0 t0 a b s1 t1.
(Applicative f, Functor g) =>
AdapterLike f g s0 t0 a b
-> AdapterLike f g s1 t1 a b
-> AdapterLike f g (s0, s1) (t0, t1) a b
beside (LensLike f s0 t0 a b -> AdapterLike f Identity s0 t0 a b
forall (g :: * -> *) a b s t.
Identical g =>
((a -> b) -> s -> t) -> GrateLike g s t a b
resetting LensLike f s0 t0 a b
la) (LensLike f s1 t1 a b -> AdapterLike f Identity s1 t1 a b
forall (g :: * -> *) a b s t.
Identical g =>
((a -> b) -> s -> t) -> GrateLike g s t a b
resetting LensLike f s1 t1 a b
lb)

ignored :: Applicative f => null -> s -> f s
-- ^ @
-- ignored :: Traversal s s a b
-- @
--
-- The empty traversal on any type.
ignored :: null -> s -> f s
ignored null
_ = s -> f s
forall (f :: * -> *) a. Applicative f => a -> f a
pure

mapped :: (Identical f, Functor h) => LensLike f (h a) (h b) a b
-- ^ @
-- mapped :: Functor h => Setter (h a) (h b) a b
-- @
--
-- An SEC referencing the parameter of a functor.
mapped :: LensLike f (h a) (h b) a b
mapped = ((a -> b) -> h a -> h b) -> LensLike f (h a) (h b) a b
forall (f :: * -> *) a b s t.
Identical f =>
((a -> b) -> s -> t) -> LensLike f s t a b
setting (a -> b) -> h a -> h b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap

backwards :: LensLike (Backwards f) s t a b -> LensLike f s t a b
-- ^ @
-- backwards :: Traversal s t a b -> Traversal s t a b
-- backwards :: Fold s t a b -> Fold s t a b
-- @
--
-- Given a traversal or fold, reverse the order that elements are traversed.
--
-- @
-- backwards :: Lens s t a b -> Lens s t a b
-- backwards :: Getter s t a b -> Getter s t a b
-- backwards :: Setter s t a b -> Setter s t a b
-- @
--
-- No effect on lenses, getters or setters.
backwards :: LensLike (Backwards f) s t a b -> LensLike f s t a b
backwards LensLike (Backwards f) s t a b
l a -> f b
f = Backwards f t -> f t
forall k (f :: k -> *) (a :: k). Backwards f a -> f a
forwards (Backwards f t -> f t) -> (s -> Backwards f t) -> s -> f t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LensLike (Backwards f) s t a b
l (f b -> Backwards f b
forall k (f :: k -> *) (a :: k). f a -> Backwards f a
Backwards (f b -> Backwards f b) -> (a -> f b) -> a -> Backwards f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> f b
f)

{- Alongside -}

newtype AlongsideLeft f b a = AlongsideLeft (f (a, b))

instance Functor f => Functor (AlongsideLeft f a) where
  fmap :: (a -> b) -> AlongsideLeft f a a -> AlongsideLeft f a b
fmap a -> b
f (AlongsideLeft f (a, a)
x) = f (b, a) -> AlongsideLeft f a b
forall (f :: * -> *) b a. f (a, b) -> AlongsideLeft f b a
AlongsideLeft (((a, a) -> (b, a)) -> f (a, a) -> f (b, a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> b) -> (a, a) -> (b, a)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first a -> b
f) f (a, a)
x)

instance Phantom f => Phantom (AlongsideLeft f a) where
  coerce :: AlongsideLeft f a a -> AlongsideLeft f a b
coerce (AlongsideLeft f (a, a)
x) = f (b, a) -> AlongsideLeft f a b
forall (f :: * -> *) b a. f (a, b) -> AlongsideLeft f b a
AlongsideLeft (f (a, a) -> f (b, a)
forall (f :: * -> *) a b. Phantom f => f a -> f b
coerce f (a, a)
x)

newtype AlongsideRight f a b = AlongsideRight (f (a, b))

instance Functor f => Functor (AlongsideRight f a) where
  fmap :: (a -> b) -> AlongsideRight f a a -> AlongsideRight f a b
fmap a -> b
f (AlongsideRight f (a, a)
x) = f (a, b) -> AlongsideRight f a b
forall (f :: * -> *) a b. f (a, b) -> AlongsideRight f a b
AlongsideRight (((a, a) -> (a, b)) -> f (a, a) -> f (a, b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> b) -> (a, a) -> (a, b)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second a -> b
f) f (a, a)
x)

instance Phantom f => Phantom (AlongsideRight f a) where
  coerce :: AlongsideRight f a a -> AlongsideRight f a b
coerce (AlongsideRight f (a, a)
x) = f (a, b) -> AlongsideRight f a b
forall (f :: * -> *) a b. f (a, b) -> AlongsideRight f a b
AlongsideRight (f (a, a) -> f (a, b)
forall (f :: * -> *) a b. Phantom f => f a -> f b
coerce f (a, a)
x)

alongside :: Functor f => LensLike (AlongsideLeft f b1) s0 t0 a0 b0
                       -> LensLike (AlongsideRight f t0) s1 t1 a1 b1
                       -> LensLike f (s0, s1) (t0, t1) (a0, a1) (b0, b1)
-- ^ @
-- alongside :: Lens s0 t0 a0 b0 -> Lens s1 t1 a1 b1 -> Lens (s0, s1) (t0, t1) (a0, a1) (b0, b1)
-- @
--
-- @
-- alongside :: Getter s0 t0 a0 b0 -> Getter s1 t1 a1 b1 -> Getter (s0, s1) (t0, t1) (a0, a1) (b0, b1)
-- @
--
-- Given two lens\/getter families, make a new lens\/getter on their product.
alongside :: LensLike (AlongsideLeft f b1) s0 t0 a0 b0
-> LensLike (AlongsideRight f t0) s1 t1 a1 b1
-> LensLike f (s0, s1) (t0, t1) (a0, a1) (b0, b1)
alongside LensLike (AlongsideLeft f b1) s0 t0 a0 b0
l0 LensLike (AlongsideRight f t0) s1 t1 a1 b1
l1 (a0, a1) -> f (b0, b1)
f (s0
s0, s1
s1) = f (t0, t1)
ft0t1
 where
  AlongsideRight f (t0, t1)
ft0t1 = LensLike (AlongsideRight f t0) s1 t1 a1 b1
l1 a1 -> AlongsideRight f t0 b1
f1 s1
s1
  f1 :: a1 -> AlongsideRight f t0 b1
f1 a1
a1 = f (t0, b1) -> AlongsideRight f t0 b1
forall (f :: * -> *) a b. f (a, b) -> AlongsideRight f a b
AlongsideRight f (t0, b1)
ft0a1
   where
    AlongsideLeft f (t0, b1)
ft0a1 = LensLike (AlongsideLeft f b1) s0 t0 a0 b0
l0 a0 -> AlongsideLeft f b1 b0
f0 s0
s0
    f0 :: a0 -> AlongsideLeft f b1 b0
f0 a0
a0 = f (b0, b1) -> AlongsideLeft f b1 b0
forall (f :: * -> *) b a. f (a, b) -> AlongsideLeft f b a
AlongsideLeft ((a0, a1) -> f (b0, b1)
f (a0
a0, a1
a1))

{- From -}

newtype FromF i j g x = FromF ((g x -> j) -> i)

instance Functor g => Functor (FromF i j g) where
  fmap :: (a -> b) -> FromF i j g a -> FromF i j g b
fmap a -> b
f (FromF (g a -> j) -> i
h) = ((g b -> j) -> i) -> FromF i j g b
forall i j (g :: * -> *) x. ((g x -> j) -> i) -> FromF i j g x
FromF (((g b -> j) -> i) -> FromF i j g b)
-> ((g b -> j) -> i) -> FromF i j g b
forall a b. (a -> b) -> a -> b
$ \g b -> j
k -> (g a -> j) -> i
h (g b -> j
k (g b -> j) -> (g a -> g b) -> g a -> j
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> g a -> g b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f)

instance Phantom g => Phantom (FromF i j g) where
  coerce :: FromF i j g a -> FromF i j g b
coerce (FromF (g a -> j) -> i
h) = ((g b -> j) -> i) -> FromF i j g b
forall i j (g :: * -> *) x. ((g x -> j) -> i) -> FromF i j g x
FromF (((g b -> j) -> i) -> FromF i j g b)
-> ((g b -> j) -> i) -> FromF i j g b
forall a b. (a -> b) -> a -> b
$ \g b -> j
k -> (g a -> j) -> i
h (g b -> j
k (g b -> j) -> (g a -> g b) -> g a -> j
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g a -> g b
forall (f :: * -> *) a b. Phantom f => f a -> f b
coerce)

newtype FromG e f x = FromG (e -> f x)

instance Functor f => Functor (FromG e f) where
  fmap :: (a -> b) -> FromG e f a -> FromG e f b
fmap a -> b
f (FromG e -> f a
h) = (e -> f b) -> FromG e f b
forall e (f :: * -> *) x. (e -> f x) -> FromG e f x
FromG ((e -> f b) -> FromG e f b) -> (e -> f b) -> FromG e f b
forall a b. (a -> b) -> a -> b
$ (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f (f a -> f b) -> (e -> f a) -> e -> f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> f a
h

instance Phantom g => Phantom (FromG e g) where
  coerce :: FromG e g a -> FromG e g b
coerce (FromG e -> g a
h) = (e -> g b) -> FromG e g b
forall e (f :: * -> *) x. (e -> f x) -> FromG e f x
FromG ((e -> g b) -> FromG e g b) -> (e -> g b) -> FromG e g b
forall a b. (a -> b) -> a -> b
$ g a -> g b
forall (f :: * -> *) a b. Phantom f => f a -> f b
coerce (g a -> g b) -> (e -> g a) -> e -> g b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> g a
h

from :: (Functor f, Functor g)
     => AdapterLike (FromF (g s -> f t) (f b) g) (FromG (f b) f) b a t s
     -> AdapterLike f g s t a b
-- ^ @
-- from :: Adapter b a t s -> Adapter s t a b
-- @
--
-- Reverses the direction of an adapter.
--
-- @
-- from :: Getter b a t s -> Reviewer s t a b
-- from :: Reviewer b a t s -> Getter s t a b
-- @
--
-- Changes a Getter into a Reviewer and vice versa.
from :: AdapterLike (FromF (g s -> f t) (f b) g) (FromG (f b) f) b a t s
-> AdapterLike f g s t a b
from AdapterLike (FromF (g s -> f t) (f b) g) (FromG (f b) f) b a t s
l = AdapterLike f g s t a b
l'
 where
  FromF AdapterLike f g s t a b
l' = AdapterLike (FromF (g s -> f t) (f b) g) (FromG (f b) f) b a t s
l (\(FromG f b -> f t
h1) -> ((g s -> f b) -> g s -> f t) -> FromF (g s -> f t) (f b) g s
forall i j (g :: * -> *) x. ((g x -> j) -> i) -> FromF i j g x
FromF (((g s -> f b) -> g s -> f t) -> FromF (g s -> f t) (f b) g s)
-> ((g s -> f b) -> g s -> f t) -> FromF (g s -> f t) (f b) g s
forall a b. (a -> b) -> a -> b
$ (f b -> f t) -> (g s -> f b) -> g s -> f t
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) f b -> f t
h1) ((f b -> f b) -> FromG (f b) f b
forall e (f :: * -> *) x. (e -> f x) -> FromG e f x
FromG f b -> f b
forall a. a -> a
id)

{-# DEPRECATED lft "Renamed as 'left'." #-}
lft :: (Applicative f, Traversable g) => AdapterLike f g (Either a r) (Either b r) a b
lft :: AdapterLike f g (Either a r) (Either b r) a b
lft = AdapterLike f g (Either a r) (Either b r) a b
forall (f :: * -> *) (g :: * -> *) a r b.
(Applicative f, Traversable g) =>
AdapterLike f g (Either a r) (Either b r) a b
left

{-# DEPRECATED lft_ "Renamed as 'left_'." #-}
lft_ :: Applicative f => LensLike f (Either a r) (Either b r) a b
lft_ :: LensLike f (Either a r) (Either b r) a b
lft_ = LensLike f (Either a r) (Either b r) a b
forall (f :: * -> *) a r b.
Applicative f =>
LensLike f (Either a r) (Either b r) a b
left_

{-# DEPRECATED rgt "Renamed as 'right'." #-}
rgt :: (Applicative f, Traversable g) => AdapterLike f g (Either r a) (Either r b) a b
rgt :: AdapterLike f g (Either r a) (Either r b) a b
rgt = AdapterLike f g (Either r a) (Either r b) a b
forall (f :: * -> *) (g :: * -> *) r a b.
(Applicative f, Traversable g) =>
AdapterLike f g (Either r a) (Either r b) a b
right

{-# DEPRECATED rgt_ "Renamed as 'right_'." #-}
rgt_ :: Applicative f => LensLike f (Either r a) (Either r b) a b
rgt_ :: LensLike f (Either r a) (Either r b) a b
rgt_ = LensLike f (Either r a) (Either r b) a b
forall (f :: * -> *) r a b.
Applicative f =>
LensLike f (Either r a) (Either r b) a b
right_

{-# DEPRECATED some "Renamed as 'just'." #-}
some :: (Applicative f, Traversable g) => AdapterLike f g (Maybe a) (Maybe b) a b
some :: AdapterLike f g (Maybe a) (Maybe b) a b
some = AdapterLike f g (Maybe a) (Maybe b) a b
forall (f :: * -> *) (g :: * -> *) a b.
(Applicative f, Traversable g) =>
AdapterLike f g (Maybe a) (Maybe b) a b
just

{-# DEPRECATED some_ "Renamed as 'just_'." #-}
some_ :: Applicative f => LensLike f (Maybe a) (Maybe b) a b
some_ :: LensLike f (Maybe a) (Maybe b) a b
some_ = LensLike f (Maybe a) (Maybe b) a b
forall (f :: * -> *) a b.
Applicative f =>
LensLike f (Maybe a) (Maybe b) a b
just_

{-# DEPRECATED none "Renamed as 'nothing'." #-}
none :: (Applicative f, Traversable g) => AdapterLike' f g (Maybe a) ()
none :: AdapterLike' f g (Maybe a) ()
none = AdapterLike' f g (Maybe a) ()
forall (f :: * -> *) (g :: * -> *) a.
(Applicative f, Traversable g) =>
AdapterLike' f g (Maybe a) ()
nothing

{-# DEPRECATED none_ "Renamed as 'nothing_'." #-}
none_ :: Applicative f => LensLike' f (Maybe a) ()
none_ :: LensLike' f (Maybe a) ()
none_ = LensLike' f (Maybe a) ()
forall (f :: * -> *) a. Applicative f => LensLike' f (Maybe a) ()
nothing_