^. package:backprop

An infix version of viewVar, meant to evoke parallels to ^. from lens. With normal values, you can extract something from that value with a lens:
x ^. myLens
would extract a piece of x :: b, specified by myLens :: Lens' b a. The result has type a.
xVar ^^. myLens
would extract a piece out of xVar :: BVar s b (a BVar holding a b), specified by myLens :: Lens' b a. The result has type BVar s a (a BVar holding a a) This is the main way to pull out values from BVar of container types. If you have control of your data type definitions, consider using splitBV, which lets you break out BVars of values into BVars of their individual fields automatically without requiring lenses. NOTE: Usage of ^^. on many fields from the same item is usually the main source of overhead in backprop code, if you are looking to optimize your code. See <https://backprop.jle.im/07-performance.html this performance guide> for more information, and details on mitigating this overhead. WARNING: Do not use with any lenses that operate "numerically" on the contents (like multiplying).
An infix version of toListOfVar, meant to evoke parallels to ^.. from lens. With normal values, you can extract all targets of a Traversal from that value with a:
x ^.. myTraversal
would extract all targets inside of x :: b, specified by myTraversal :: Traversal' b a. The result has type [a].
xVar ^^.. myTraversal
would extract all targets inside of xVar :: BVar s b (a BVar holding a b), specified by myTraversal :: Traversal' b a. The result has type [BVar s a] (A list of BVars holding as). NOTE: Has all of the performance overhead issues of sequenceVar; see documentation for sequenceVar for more information.
^^., but with Num constraints instead of Backprop constraints.
^^.., but with Num constraints instead of Backprop constraints.