proto-lens-0.7.1.4: A lens-based implementation of protocol buffers in Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.ProtoLens.Field

Description

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.

Synopsis

Documentation

class HasField s (x :: Symbol) a | s x -> a where Source #

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

fieldOf :: Functor f => Proxy# x -> (a -> f a) -> s -> f s Source #

field :: forall x s a f. (HasField s x a, Functor f) => (a -> f a) -> s -> f s Source #

A lens for a given field. For example:

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