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

Modulelens-family-2.1.3Haskell2010

Lens.Family2.Stock

This module contains lenses, prisms, grids, grates and traversals for common structures in Haskell. It also contains the combinators for various kinds of optics.

A Function name with ' is a grate variant of a grid, and a function name with _ is a traversal variants of a grid or prism. For example, both' is the grate variant of both while both_ is the traversal variant.

  • 16 types
  • 2 classes
  • 45 values
  • Packagelens-family-2.1.3
  • Exports63
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceStock.hs

Stock Lenses

10 declarations
value_1 :: Functor f => LensLike f (a, r) (b, r) a b
#

Lens on the first element of a pair.

value_2 :: Functor f => LensLike f (r, a) (r, b) a b
#

Lens on the second element of a pair.

valueix :: Eq k => k -> Lens' (k -> v) v
#

Lens on a given point of a function.

Stock Prisms

4 declarations

Stock Grids

3 declarations
valuebend :: FiniteBits b => Grid' b Bool
#

A grid from the most significant bit to the least significant bit of a FiniteBits type.

Big endian order.

valuelend :: FiniteBits b => Grid' b Bool
#

A grid from the least significant bit to the most significant bit of a FiniteBits type.

Little endian order.

Stock Grates

4 declarations
valuecod :: Functor g => GrateLike g (r -> a) (r -> b) a b
#

A grate accessing the codomain of a function.

valuebend' :: FiniteBits b => Grate' b Bool
#

A grate from the most significant bit to the least significant bit of a FiniteBits type.

Big endian order.

valuelend' :: FiniteBits b => Grate' b Bool
#

A grate from the least significant bit to the most significant bit of a FiniteBits type.

Little endian order.

Stock Traversals

8 declarations
valuebend_ :: FiniteBits b => Traversal' b Bool
#

A traversal from the most significant bit to the least significant bit of a FiniteBits type.

Big endian order.

valuelend_ :: FiniteBits b => Traversal' b Bool
#

A traversal from the least significant bit to the most significant bit of a FiniteBits type.

Little endian order.

Stock SECs

1 declaration
valuemapped :: Functor f => Setter (f a) (f a') a a'
#

An SEC referencing the parameter of a functor.

Lens Combinators

7 declarations
valuealongside
  1. :: Functor f
  2. => LensLike (AlongsideLeft f b1) s0 t0 a0 b0
  3. -> LensLike (AlongsideRight f t0) s1 t1 a1 b1
  4. -> LensLike f (s0, s1) (t0, t1) (a0, a1) (b0, b1)
#
alongside :: Lens s0 t0 a0 b0 -> Lens s1 t1 a1 b1 -> Lens (s0, s1) (t0, t1) (a0, a1) (b0, b1)
alongside :: Getter s0 t0 a0 b0 -> Getter s1 t1 a1 b1 -> Getter (s0, s1) (t0, t1) (a0, a1) (b0, b1)

Given two lens/getter families, make a new lens/getter on their product.

valuebackwards :: LensLike (Backwards f) s t a b -> LensLike f s t a b
#
backwards :: Traversal s t a b -> Traversal s t a b
backwards :: Fold s t a b -> Fold s t a b

Given a traversal or fold, reverse the order that elements are traversed.

backwards :: Lens s t a b -> Lens s t a b
backwards :: Getter s t a b -> Getter s t a b
backwards :: Setter s t a b -> Setter s t a b

No effect on lenses, getters or setters.

valuebeside
  1. :: (Applicative f, Functor g)
  2. => AdapterLike f g s0 t0 a b
  3. -> AdapterLike f g s1 t1 a b
  4. -> AdapterLike f g (s0, s1) (t0, t1) a b
#
beside :: Grid s1 t1 a b -> Grid s2 t2 a b -> Grid (s1, s2) (t1, t2) a b

Given two grids referencing a type c, create a grid on the pair referencing c.

valuebeside'
  1. :: Functor g
  2. => GrateLike g s0 t0 a b
  3. -> GrateLike g s1 t1 a b
  4. -> GrateLike g (s0, s1) (t0, t1) a b
#
beside' :: Grate s0 t0 a b -> Grate s1 t1 a b -> Grate (s0, s1) (t0, t1) a b
beside' :: Resetter s0 t0 a b -> Resetter s1 t1 a b -> Resetter (s0, s1) (t0, t1) a b

Given two grates/resetters referencing a type c, create a grate/resetter on the pair referencing c.

valuebeside_
  1. :: Applicative f
  2. => LensLike f s0 t0 a b
  3. -> LensLike f s1 t1 a b
  4. -> LensLike f (s0, s1) (t0, t1) a b
#
beside_ :: Traversal s0 t0 a b -> Traversal s1 t1 a b -> Traversal (s0, s1) (t0, t1) a b
beside_ :: Fold s0 t0 a b -> Fold s1 t1 a b -> Fold (s0, s1) (t0, t1) a b
beside_ :: Setter s0 t0 a b -> Setter s1 t1 a b -> Setter (s0, s1) (t0, t1) a b

Given two traversals/folds/setters referencing a type c, create a traversal/fold/setter on the pair referencing c.

valuechoosing
  1. :: Functor f
  2. => LensLike f s0 t0 a b
  3. -> LensLike f s1 t1 a b
  4. -> LensLike f (Either s0 s1) (Either t0 t1) a b
#
choosing :: Lens s0 t0 a b -> Lens s1 t1 a b -> Lens (Either s0 s1) (Either t0 t1) a b
choosing :: Traversal s0 t0 a b -> Traversal s1 t1 a b -> Traversal (Either s0 s1) (Either t0 t1) a b
choosing :: Getter s0 t0 a b -> Getter s1 t1 a b -> Getter (Either s0 s1) (Either t0 t1) a b
choosing :: Fold s0 t0 a b -> Fold s1 t1 a b -> Fold (Either s0 s1) (Either t0 t1) a b
choosing :: Setter s0 t0 a b -> Setter s1 t1 a b -> Setter (Either s0 s1) (Either t0 t1) a b

Given two lens/traversal/getter/fold/setter families with the same substructure, make a new lens/traversal/getter/fold/setter on Either.

valuefrom
  1. :: (Functor f, Functor g)
  2. => AdapterLike (FromF (g s -> f t) (f b) g) (FromG (f b) f) b a t s
  3. -> AdapterLike f g s t a b
#
from :: Adapter b a t s -> Adapter s t a b

Reverses the direction of an adapter.

from :: Getter b a t s -> Reviewer s t a b
from :: Reviewer b a t s -> Getter s t a b

Changes a Getter into a Reviewer and vice versa.

Types

4 declarations

Re-exports

14 declarations
newtypenewtype Backwards (f :: k -> Type) (a :: k)
#

The same functor, but with an Applicative instance that performs actions in the reverse order.

Instances21Generic1, Functor, Applicative, Foldable, Traversable, Alternative, …
classclass Bits b => FiniteBits b where
#

The FiniteBits class denotes types with a finite, fixed number of bits.

Instances63FiniteBits, …

Deprecated names

8 declarations