HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulegeneric-lens-2.3.0.0Haskell2010

Data.Generics.Product.Any

Derive a variety of lenses generically.

  • 1 class

Lenses

1 declaration

Running example:

Example6 expressions
:set -XTypeApplications:set -XDataKinds:set -XDeriveGenericimport GHC.Generics:m +Data.Generics.Internal.VL.Lens:{data Human = Human  { name    :: String  , age     :: Int  , address :: String  }  deriving (Generic, Show)human :: Humanhuman = Human "Tunyasz" 50 "London":}
classclass HasAny (sel :: k) s t a b | s sel -> a where
#

Methods

  • the :: Lens s t a b

    A lens that focuses on a part of a product as identified by some selector. Currently supported selectors are field names, positions and unique types. Compatible with the lens package's Control.Lens.Lens type.

    Example1 expression
    human ^. the @Int50
    Example1 expression
    human ^. the @"name""Tunyasz"
    Example1 expression
    human ^. the @3"London"
Instances3HasAny
  • HasField field s t a b => HasAny field s t a bDefined in generic-lens-2.3.0.0 · Data.Generics.Product.Any
  • HasPosition i s t a b => HasAny i s t a bDefined in generic-lens-2.3.0.0 · Data.Generics.Product.Any
  • (HasType a s, t ~ s, a ~ b) => HasAny a s t a bDefined in generic-lens-2.3.0.0 · Data.Generics.Product.Any