HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleoptics-extra-0.4.2.1Haskell2010

Optics.View

EXPERIMENTAL

  • 1 class
  • 4 values
classclass ViewableOptic (k :: OpticKind) r where
#

Generalized view (even more powerful than view from the lens library).

View the value(s) pointed to by an optic.

The type of the result depends on the optic. You get:

When in doubt, use specific, flavour restricted versions. This function is mostly useful for things such as passthrough.

Associated types

Methods

Instances9ViewableOptic, …
valueguse
  1. :: (ViewableOptic k a, MonadState s m)
  2. => Optic' k is s a
  3. -> m (ViewResult k a)
#

Use the target of a Lens, Iso, or Getter in the current state, or use a summary of a Fold or Traversal that points to a monoidal value.

Example1 expression
evalState (guse _1) ('a','b')'a'
Example1 expression
evalState (guse _2) ("hello","world")"world"