generic-lens-0.4.0.1: 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.Typed

Contents

Description

Derive record field getters and setters generically.

Synopsis

Lenses

class HasType a s where #

Records that have a field with a unique type.

Minimal complete definition

typed | setTyped, getTyped

Methods

typed :: Lens' s a #

A lens that focuses on a field with a unique type in its parent type. Compatible with the lens package's Lens type.

>>> human ^. typed @Int
50

getTyped :: s -> a #

Get field at type.

setTyped :: a -> s -> s #

Set field at type.

Instances

(Generic s, ErrorUnlessOne a s (CountTotalType * a (Rep s)), GHasType (Rep s) a) => HasType a s # 

Methods

typed :: Lens' s a #

getTyped :: s -> a #

setTyped :: a -> s -> s #