.~ -package:universum

Replace the target of a Lens or all of the targets of a Setter or Traversal with a constant value. This is an infix version of set, provided for consistency with (.=).
f <$ a ≡ mapped .~ f $ a
>>> (a,b,c,d) & _4 .~ e
(a,b,c,e)
>>> (42,"world") & _1 .~ "hello"
("hello","world")
>>> (a,b) & both .~ c
(c,c)
(.~) :: Setter s t a b    -> b -> s -> t
(.~) :: Iso s t a b       -> b -> s -> t
(.~) :: Lens s t a b      -> b -> s -> t
(.~) :: Traversal s t a b -> b -> s -> t
(.~) assigns a value to the target. It's the same thing as using (%~) with const:
l .~ x = l %~ const x
See set if you want a non-operator synonym. Here it is used to change 2 fields of a 3-tuple:
>>> (0,0,0) & _1 .~ 1 & _3 .~ 3
(1,0,3)
The operator form of set.
Infix version of set.
Set all referenced fields to the given value.
Set all referenced fields to the given value.
Reverse composition, but with the side effects still in left-to-right order.
Synonym for set
Symbolic nand
Symbolic nor
An infix version of setVar, meant to evoke parallels to .~ from lens. With normal values, you can set something in a value with a lens:
x & myLens .~ y
would "set" a part of x :: b, specified by myLens :: Lens' a b, to a new value y :: a.
xVar & myLens .~~ yVar
would "set" a part of xVar :: BVar s b (a BVar holding a b), specified by myLens :: Lens' a b, to a new value given by yVar :: BVar s a. The result is a new (updated) value of type BVar s b. This is the main way to set values inside BVars of container types. Note that this does not incurr the performance overhead issues of viewVar and ^^., and is fairly cheap.
.~~, but with Num constraints instead of Backprop constraints.
Replace the target of a Lens, but return the old value. When you do not need the old value, (.~) is more flexible.
(<<.~) ::             Lens s t a b      -> b -> s -> (a, t)
(<<.~) ::             Iso s t a b       -> b -> s -> (a, t)
(<<.~) :: Monoid a => Traversal s t a b -> b -> s -> (a, t)
Set with pass-through. This is mostly present for consistency, but may be useful for chaining assignments. If you do not need a copy of the intermediate result, then using l .~ t directly is a good idea.
>>> (a,b) & _1 <.~ c
(c,(c,b))
>>> ("good","morning","vietnam") & _3 <.~ "world"
("world",("good","morning","world"))
>>> (42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"
(Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))
(<.~) :: Setter s t a b    -> b -> s -> (b, t)
(<.~) :: Iso s t a b       -> b -> s -> (b, t)
(<.~) :: Lens s t a b      -> b -> s -> (b, t)
(<.~) :: Traversal s t a b -> b -> s -> (b, t)
Bitwise .&. the target(s) of a Lens or Setter.
>>> _2 .&.~ 7 $ ("hello",254)
("hello",6)
(.&.~) :: Bits a             => Setter s t a a    -> a -> s -> t
(.&.~) :: Bits a             => Iso s t a a       -> a -> s -> t
(.&.~) :: Bits a             => Lens s t a a      -> a -> s -> t
(.&.~) :: (Monoid a, Bits a) => Traversal s t a a -> a -> s -> t
Bitwise .|. the target(s) of a Lens or Setter.
>>> _2 .|.~ 6 $ ("hello",3)
("hello",7)
(.|.~) :: Bits a             => Setter s t a a    -> a -> s -> t
(.|.~) :: Bits a             => Iso s t a a       -> a -> s -> t
(.|.~) :: Bits a             => Lens s t a a      -> a -> s -> t
(.|.~) :: (Monoid a, Bits a) => Traversal s t a a -> a -> s -> t
Bitwise .&. the target(s) of a Lens or Traversal, returning the result (or a monoidal summary of all of the results).
>>> _2 <.&.~ 7 $ ("hello",254)
(6,("hello",6))
(<.&.~) :: Bits a             => Iso       s t a a -> a -> s -> (a, t)
(<.&.~) :: Bits a             => Lens      s t a a -> a -> s -> (a, t)
(<.&.~) :: (Bits a, Monoid a) => Traversal s t a a -> a -> s -> (a, t)
Bitwise .|. the target(s) of a Lens (or Traversal), returning the result (or a monoidal summary of all of the results).
>>> _2 <.|.~ 6 $ ("hello",3)
(7,("hello",7))
(<.|.~) :: Bits a             => Iso s t a a       -> a -> s -> (a, t)
(<.|.~) :: Bits a             => Lens s t a a      -> a -> s -> (a, t)
(<.|.~) :: (Bits a, Monoid a) => Traversal s t a a -> a -> s -> (a, t)
Bitwise .&. the target(s) of a Lens or Traversal, and return the original value, or a monoidal summary of the original values. When you do not need the old value, (.&.~) is more flexible.
>>> _2 <<.&.~ 7 $ ("hello", 254)
(254,("hello",6))
(<<.&.~) ::  Bits a            => Iso s t a a       -> a -> s -> (a, t)
(<<.&.~) ::  Bits a            => Lens s t a a      -> a -> s -> (a, t)
(<<.&.~) :: (Bits a, Monoid a) => Traversal s t a a -> a -> s -> (a, t)
Bitwise .|. the target(s) of a Lens or Traversal, and return the original value, or a monoidal summary of the original values. When you do not need the old value, (.|.~) is more flexible.
>>> _2 <<.|.~ 6 $ ("hello", 3)
(3,("hello",7))
(<<.|.~) ::  Bits a            => Iso s t a a       -> a -> s -> (a, t)
(<<.|.~) ::  Bits a            => Lens s t a a      -> a -> s -> (a, t)
(<<.|.~) :: (Bits a, Monoid a) => Traversal s t a a -> a -> s -> (a, t)
This is a version of (.~) which modifies the structure and returns it along with the old value:
>>> (1, 2) & _1 <<.~ 0
(1, (0, 2))
Simpler type signatures:
(<<.~) ::             Lens s t a b      -> b -> s -> (a, t)
(<<.~) :: Monoid a => Traversal s t a b -> b -> s -> (a, t)
Infix version of unsafeIndex.