View the value pointed to by a Getter or Lens or the
result of folding over all the results of a Fold or
Traversal that points at a monoidal values.
This is the same operation as view with the arguments flipped.
The fixity and semantics are such that subsequent field accesses can
be performed with (.).

>>> (a,b)^._2 b

>>> ("hello","world")^._2 "world"

>>> import Data.Complex >>> ((0, 1 :+ 2), 3)^._1._2.to magnitude 2.23606797749979

(^.) :: s -> Getter s a -> a (^.) :: Monoid m => s -> Fold s m -> m (^.) :: s -> Iso' s a -> a (^.) :: s -> Lens' s a -> a (^.) :: Monoid m => s -> Traversal' s m -> m

(^.) applies a getter to a value; in other words, it gets a
value out of a structure using a getter (which can be a lens,
traversal, fold, etc.).
Getting 1st field of a tuple:
`view`, and
it's a bit more general than (^.) (it works in
`MonadReader`). If you need the general version, you can get it
from microlens-mtl; otherwise there's view available in
Lens.Micro.Extras.

(^. _1) :: (a, b) -> a (^. _1) = fstWhen (^.) is used with a traversal, it combines all results using the Monoid instance for the resulting type. For instance, for lists it would be simple concatenation:

>>> ("str","ing") ^. each "string"The reason for this is that traversals use Applicative, and the Applicative instance for Const uses monoid concatenation to combine “effects” of Const. A non-operator version of (^.) is called

get as infix operator. This lets us write
`record^.field^.subfield`. This imitates Modula II syntax.

(^.) :: s -> Getter s t a b -> aAccess the value referenced by a getter or lens.

(^.) :: Monoid a => s -> Fold s t a b -> aAccess the monoidal summary referenced by a traversal or a fold.

esqueleto Database.Esqueleto Database.Esqueleto.Experimental Database.Esqueleto.Internal.Internal Database.Esqueleto.Legacy

Project a field of an entity.

The operator form of view with the arguments flipped.

Flipped infix version of view.

Infix version of getL (with the reverse order of the arguments)

Field access, inspired by the lens library. This is merely reverse
application, but allows us to write things like `(1, 2)^._1`
which is likely to be familiar to most Haskell programmers out there.
Note that this is precisely equivalent to `_1 (1, 2)`, but
perhaps it reads a little nicer.

Get inner part `i` of structure `o` as designated by
`Lens' i o`.

(^.) applies a getter to a value; in other words, it gets a
value out of a structure using a getter (which can be a lens,
traversal, fold, etc.).
Getting 1st field of a tuple:
`view`, and
it's a bit more general than (^.) (it works in
`MonadReader`). If you need the general version, you can get it
from microlens-mtl; otherwise there's view available in
Lens.Micro.Extras.

(^. _1) :: (a, b) -> a (^. _1) = fstWhen (^.) is used with a traversal, it combines all results using the Monoid instance for the resulting type. For instance, for lists it would be simple concatenation:

>>> ("str","ing") ^. each "string"The reason for this is that traversals use Applicative, and the Applicative instance for Const uses monoid concatenation to combine “effects” of Const. A non-operator version of (^.) is called

View the value pointed to by a Getter or Lens or the
result of folding over all the results of a Fold or
Traversal that points at a monoidal values.
This is the same operation as view with the arguments flipped.
The fixity and semantics are such that subsequent field accesses can
be performed with (.).

>>> (a,b)^._2 b

>>> ("hello","world")^._2 "world"

>>> import Data.Complex >>> ((0, 1 :+ 2), 3)^._1._2.to magnitude 2.23606797749979

(^.) :: s -> Getter s a -> a (^.) :: Monoid m => s -> Fold s m -> m (^.) :: s -> Iso' s a -> a (^.) :: s -> Lens' s a -> a (^.) :: Monoid m => s -> Traversal' s m -> m

A convenient infix (flipped) version of toListOf.

>>> [[1,2],[3]]^..id [[[1,2],[3]]] >>> [[1,2],[3]]^..traverse [[1,2],[3]] >>> [[1,2],[3]]^..traverse.traverse [1,2,3]

>>> (1,2)^..both [1,2]

toList xs ≡ xs ^.. folded (^..) ≡ flip toListOf

(^..) :: s -> Getter s a -> a :: s -> Fold s a -> a :: s -> Lens' s a -> a :: s -> Iso' s a -> a :: s -> Traversal' s a -> a :: s -> Prism' s a -> [a]

>>> Just 3 ^.. _Just [3]Gathering all values in a list of tuples:

>>> [(1,2),(3,4)] ^.. each.each [1,2,3,4]

Returns a list of all of the referenced values in order.

(^..) :: s -> Fold s t a b -> [a]Returns a list of all of the referenced values in order.

Flipped infix version of toListOf.