HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleproto-lens-0.7.1.5Haskell2010

Data.ProtoLens.Field

An implementation of overloaded record fields. This module enables different types in the same module to have fields of the same name.

To use instances from this class, either:

  • Enable the OverloadedLabels extension and import Data.ProtoLens.Labels ();

  • Use the field function along with the TypeApplications extension; or,

  • Import the corresponding names from the autogenerated *_Fields module.

For more information, see https://google.github.io/proto-lens/tutorial.html#field-overloading.

  • 1 class
  • 1 value
classclass HasField s (x :: Symbol) a | s x -> a where
#

A type class for lens fields.

The instance HasField s x a can be understood as "s has a field named x of type a".

Methods

valuefield :: (HasField s x a, Functor f) => (a -> f a) -> s -> f s
#

A lens for a given field. For example:

view field@"abc" x
set field@"abc" 42 x