generics-sop-lens-0.2.0.1: Lenses for types in generics-sop

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.Lens

Contents

Description

Lenses for Generics.SOP

Orphan instances:

Wrapped (SOP f xss) -- Also Rewrapped
Wrapped (POP f xss)
Field1 (NP f (x ': zs)) (NP f (y ': zs)) (f x) (f y) -- Field2 etc.
Field1 (POP f (x ': zs)) (NP f (y ': zs)) (NP f x) (NP f y)
Synopsis

Representations

rep :: (Generic a, Generic b) => Iso a b (Rep a) (Rep b) Source #

Convert from the data type to its representation (or back).

>>> Just 'x' ^. rep
SOP (S (Z (I 'x' :* Nil)))

productRep :: (IsProductType a xs, IsProductType b ys) => Iso a b (NP I xs) (NP I ys) Source #

Convert from the product data type to its representation (or back)

>>> ('x', True) ^. productRep
I 'x' :* I True :* Nil

SOP & POP

sop :: forall k (f :: k -> Type) xss yss. Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss) Source #

The only field of SOP.

>>> Just 'x' ^. rep . sop
S (Z (I 'x' :* Nil))

pop :: forall k (f :: k -> Type) xss yss. Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss) Source #

The only field of POP.

_SOP :: forall k (f :: k -> Type) xss yss. Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss) Source #

Alias for sop.

_POP :: forall k (f :: k -> Type) xss yss. Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss) Source #

Alias for pop.

Functors

_I :: Iso (I a) (I b) a b Source #

_K :: Iso (K a c) (K b c) a b Source #

Products

npSingleton :: forall k (f :: k -> Type) x y. Iso (NP f '[x]) (NP f '[y]) (f x) (f y) Source #

npHead :: forall k (f :: k -> Type) x y zs. Lens (NP f (x ': zs)) (NP f (y ': zs)) (f x) (f y) Source #

npTail :: forall k (f :: k -> Type) x ys zs. Lens (NP f (x ': ys)) (NP f (x ': zs)) (NP f ys) (NP f zs) Source #

Sums

nsSingleton :: forall k (f :: k -> Type) x y. Iso (NS f '[x]) (NS f '[y]) (f x) (f y) Source #

_Z :: forall k (f :: k -> Type) x y zs. Prism (NS f (x ': zs)) (NS f (y ': zs)) (f x) (f y) Source #

_S :: forall k (f :: k -> Type) x ys zs. Prism (NS f (x ': ys)) (NS f (x ': zs)) (NS f ys) (NS f zs) Source #

DatatypeInfo

constructorName :: Lens' (ConstructorInfo xs) ConstructorName Source #

Note: Infix constructor has operator as a ConstructorName. Use as setter with care.

strictnessInfo :: Traversal' (DatatypeInfo xss) (POP StrictnessInfo xss) Source #

Strictness info is only aviable for ADT data. This combinator is available only with generics-sop 0.5 or later.

Orphan instances

Wrapped (I a) Source # 
Instance details

Associated Types

type Unwrapped (I a) :: Type #

Methods

_Wrapped' :: Iso' (I a) (Unwrapped (I a)) #

t ~ I a => Rewrapped (I a) t Source # 
Instance details

Wrapped (K a b) Source # 
Instance details

Associated Types

type Unwrapped (K a b) :: Type #

Methods

_Wrapped' :: Iso' (K a b) (Unwrapped (K a b)) #

Wrapped (POP f xss) Source # 
Instance details

Associated Types

type Unwrapped (POP f xss) :: Type #

Methods

_Wrapped' :: Iso' (POP f xss) (Unwrapped (POP f xss)) #

Wrapped (SOP f xss) Source # 
Instance details

Associated Types

type Unwrapped (SOP f xss) :: Type #

Methods

_Wrapped' :: Iso' (SOP f xss) (Unwrapped (SOP f xss)) #

xs ~ (x ': ([] :: [k])) => Wrapped (NS f xs) Source # 
Instance details

Associated Types

type Unwrapped (NS f xs) :: Type #

Methods

_Wrapped' :: Iso' (NS f xs) (Unwrapped (NS f xs)) #

t ~ K a b => Rewrapped (K a b) t Source # 
Instance details

t ~ POP f xss => Rewrapped (POP f xss) t Source # 
Instance details

t ~ SOP f xss => Rewrapped (SOP f xss) t Source # 
Instance details

(t ~ NS f xs, xs ~ (x ': ([] :: [k]))) => Rewrapped (NS f xs) t Source # 
Instance details

Field1 (NP f (x ': zs)) (NP f (y ': zs)) (f x) (f y) Source # 
Instance details

Methods

_1 :: Lens (NP f (x ': zs)) (NP f (y ': zs)) (f x) (f y) #

Field2 (NP f (a2 ': (x ': zs))) (NP f (a2 ': (y ': zs))) (f x) (f y) Source # 
Instance details

Methods

_2 :: Lens (NP f (a2 ': (x ': zs))) (NP f (a2 ': (y ': zs))) (f x) (f y) #

Field3 (NP f (a2 ': (b ': (x ': zs)))) (NP f (a2 ': (b ': (y ': zs)))) (f x) (f y) Source # 
Instance details

Methods

_3 :: Lens (NP f (a2 ': (b ': (x ': zs)))) (NP f (a2 ': (b ': (y ': zs)))) (f x) (f y) #

Field4 (NP f (a2 ': (b ': (c ': (x ': zs))))) (NP f (a2 ': (b ': (c ': (y ': zs))))) (f x) (f y) Source # 
Instance details

Methods

_4 :: Lens (NP f (a2 ': (b ': (c ': (x ': zs))))) (NP f (a2 ': (b ': (c ': (y ': zs))))) (f x) (f y) #

Field5 (NP f (a2 ': (b ': (c ': (d ': (x ': zs)))))) (NP f (a2 ': (b ': (c ': (d ': (y ': zs)))))) (f x) (f y) Source # 
Instance details

Methods

_5 :: Lens (NP f (a2 ': (b ': (c ': (d ': (x ': zs)))))) (NP f (a2 ': (b ': (c ': (d ': (y ': zs)))))) (f x) (f y) #

Field6 (NP f (a2 ': (b ': (c ': (d ': (e ': (x ': zs))))))) (NP f (a2 ': (b ': (c ': (d ': (e ': (y ': zs))))))) (f x) (f y) Source # 
Instance details

Methods

_6 :: Lens (NP f (a2 ': (b ': (c ': (d ': (e ': (x ': zs))))))) (NP f (a2 ': (b ': (c ': (d ': (e ': (y ': zs))))))) (f x) (f y) #

Field7 (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (x ': zs)))))))) (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (y ': zs)))))))) (f' x) (f' y) Source # 
Instance details

Methods

_7 :: Lens (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (x ': zs)))))))) (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (y ': zs)))))))) (f' x) (f' y) #

Field8 (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (x ': zs))))))))) (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (y ': zs))))))))) (f' x) (f' y) Source # 
Instance details

Methods

_8 :: Lens (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (x ': zs))))))))) (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (y ': zs))))))))) (f' x) (f' y) #

Field9 (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (x ': zs)))))))))) (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (y ': zs)))))))))) (f' x) (f' y) Source # 
Instance details

Methods

_9 :: Lens (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (x ': zs)))))))))) (NP f' (a2 ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (y ': zs)))))))))) (f' x) (f' y) #

Field1 (POP f (x ': zs)) (POP f (y ': zs)) (NP f x) (NP f y) Source # 
Instance details

Methods

_1 :: Lens (POP f (x ': zs)) (POP f (y ': zs)) (NP f x) (NP f y) #

Field2 (POP f (a ': (x ': zs))) (POP f (a ': (y ': zs))) (NP f x) (NP f y) Source # 
Instance details

Methods

_2 :: Lens (POP f (a ': (x ': zs))) (POP f (a ': (y ': zs))) (NP f x) (NP f y) #

Field3 (POP f (a ': (b ': (x ': zs)))) (POP f (a ': (b ': (y ': zs)))) (NP f x) (NP f y) Source # 
Instance details

Methods

_3 :: Lens (POP f (a ': (b ': (x ': zs)))) (POP f (a ': (b ': (y ': zs)))) (NP f x) (NP f y) #

Field4 (POP f (a ': (b ': (c ': (x ': zs))))) (POP f (a ': (b ': (c ': (y ': zs))))) (NP f x) (NP f y) Source # 
Instance details

Methods

_4 :: Lens (POP f (a ': (b ': (c ': (x ': zs))))) (POP f (a ': (b ': (c ': (y ': zs))))) (NP f x) (NP f y) #

Field5 (POP f (a ': (b ': (c ': (d ': (x ': zs)))))) (POP f (a ': (b ': (c ': (d ': (y ': zs)))))) (NP f x) (NP f y) Source # 
Instance details

Methods

_5 :: Lens (POP f (a ': (b ': (c ': (d ': (x ': zs)))))) (POP f (a ': (b ': (c ': (d ': (y ': zs)))))) (NP f x) (NP f y) #

Field6 (POP f (a ': (b ': (c ': (d ': (e ': (x ': zs))))))) (POP f (a ': (b ': (c ': (d ': (e ': (y ': zs))))))) (NP f x) (NP f y) Source # 
Instance details

Methods

_6 :: Lens (POP f (a ': (b ': (c ': (d ': (e ': (x ': zs))))))) (POP f (a ': (b ': (c ': (d ': (e ': (y ': zs))))))) (NP f x) (NP f y) #

Field7 (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (x ': zs)))))))) (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (y ': zs)))))))) (NP f' x) (NP f' y) Source # 
Instance details

Methods

_7 :: Lens (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (x ': zs)))))))) (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (y ': zs)))))))) (NP f' x) (NP f' y) #

Field8 (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (x ': zs))))))))) (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (y ': zs))))))))) (NP f' x) (NP f' y) Source # 
Instance details

Methods

_8 :: Lens (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (x ': zs))))))))) (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (y ': zs))))))))) (NP f' x) (NP f' y) #

Field9 (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (x ': zs)))))))))) (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (y ': zs)))))))))) (NP f' x) (NP f' y) Source # 
Instance details

Methods

_9 :: Lens (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (x ': zs)))))))))) (POP f' (a ': (b ': (c ': (d ': (e ': (f ': (g ': (h ': (y ': zs)))))))))) (NP f' x) (NP f' y) #