get package:rio

Return the state from the internals of the monad.
Lifted getContents
Lifted getLine
Lifted getContents
O(1) - Get the number of elements that is currently in the Deque
Lifted version of getSearchPath
Check if a process has exited and, if so, return its ExitCode.
Same as getExitCode, but in STM.
Get the child's standard error stream value.
Get the child's standard input stream value.
Get the child's standard output stream value.
Gets specific component of the state, using a projection function supplied.
The resolution of getSystemTime, getCurrentTime, getPOSIXTime
Functions that operate on getters and folds – such as (^.), (^..), (^?) – use Getter r s a (with different values of r) to describe what kind of result they need. For instance, (^.) needs the getter to be able to return a single value, and so it accepts a getter of type Getting a s a. (^..) wants the getter to gather values together, so it uses Getting (Endo [a]) s a (it could've used Getting [a] s a instead, but it's faster with Endo). The choice of r depends on what you want to do with elements you're extracting from s.
A SimpleGetter s a extracts a from s; so, it's the same thing as (s -> a), but you can use it in lens chains because its type looks like this:
type SimpleGetter s a =
forall r. (a -> Const r a) -> s -> Const r s
Since Const r is a functor, SimpleGetter has the same shape as other lens types and can be composed with them. To get (s -> a) out of a SimpleGetter, choose r ~ a and feed Const :: a -> Const a a to the getter:
-- the actual signature is more permissive:
-- view :: Getting a s a -> s -> a
view :: SimpleGetter s a -> s -> a
view getter = getConst . getter Const
The actual Getter from lens is more general:
type Getter s a =
forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s
I'm not currently aware of any functions that take lens's Getter but won't accept SimpleGetter, but you should try to avoid exporting SimpleGetters anyway to minimise confusion. Alternatively, look at microlens-contra, which provides a fully lens-compatible Getter. Lens users: you can convert a SimpleGetter to Getter by applying to . view to it.