generic-labels-0.1.0.1: Generically extract and replace collections of record fields
Safe HaskellNone
LanguageHaskell2010

Data.Generic.Labels.Internal

Description

Internal module containing the generics machinery to provide the instances exported by this library, using GLens.

Warnings:

  • contains an incoherent instance for GAdapt which is used to prioritise built-in record field names over explicitly labelled types;
  • contains an orphan overlapping instance for generic-lens's GLens typeclass, which is used to additionally unwrap through labelled types.
Synopsis
  • class GAdapt args opt all where
    • gAdapt :: args p -> opt p -> all p

Documentation

class GAdapt args opt all where Source #

Generic version of Adapt.

Methods

gAdapt :: args p -> opt p -> all p Source #

Instances

Instances details
GLens' (HasTotalLabelPSym lbl) (args :*: opts) all => GAdapt args opts (S1 ('MetaSel ('Just lbl) p f b) (Rec0 all)) Source # 
Instance details

Defined in Data.Generic.Labels.Internal

Methods

gAdapt :: args p0 -> opts p0 -> S1 ('MetaSel ('Just lbl) p f b) (Rec0 all) p0 Source #

GAdapt args opt all => GAdapt args opt (D1 c all) Source # 
Instance details

Defined in Data.Generic.Labels.Internal

Methods

gAdapt :: args p -> opt p -> D1 c all p Source #

GAdapt args opt all => GAdapt args opt (C1 c all) Source # 
Instance details

Defined in Data.Generic.Labels.Internal

Methods

gAdapt :: args p -> opt p -> C1 c all p Source #

(GAdapt args opt all1, GAdapt args opt all2) => GAdapt args opt (all1 :*: all2) Source # 
Instance details

Defined in Data.Generic.Labels.Internal

Methods

gAdapt :: args p -> opt p -> (all1 :*: all2) p Source #

GLens' (HasTotalLabelPSym lbl) (args :*: opts) all => GAdapt args opts (M1 m meta (Rec0 (lbl := all))) Source #

This instance is INCOHERENT because we assume that no type variable (say all0) will later be instantiated to a labelled type lbl := all.

The end result is that, when we have both a built-in Haskell record field name as well as an explicit label, we prioritise the built-in record field name over the label.

Instance details

Defined in Data.Generic.Labels.Internal

Methods

gAdapt :: args p -> opts p -> M1 m meta (Rec0 (lbl := all)) p Source #

Orphan instances

LabelIso (GetLabel a') (GetLabel b') a' b' a b => GLens pred (K1 r a' :: Type -> Type) (K1 r b' :: Type -> Type) a b Source # 
Instance details

Methods

glens :: Lens (K1 r a' x) (K1 r b' x) a b #