generic-lens-0.4.0.0: Generic data-structure operations exposed as lenses.

Copyright(C) 2017 Csongor Kiss
LicenseBSD3
MaintainerCsongor Kiss <kiss.csongor.kiss@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Generics.Product.Any

Contents

Description

Derive a variety of lenses generically.

Synopsis

Lenses

class HasAny (sel :: k) a s | s sel k -> a where #

Records that have generic lenses.

Minimal complete definition

the

Methods

the :: Lens' s a #

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 Lens type.

>>> human ^. the @Int
50
>>> human ^. the @"name"
"Tunyasz"
>>> human ^. the @3
"London"

Instances

HasPosition i a s => HasAny Nat i a s # 

Methods

the :: Lens' s s #

HasField field a s => HasAny Symbol field a s # 

Methods

the :: Lens' s s #

HasType a s => HasAny * a a s # 

Methods

the :: Lens' s s #