Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generalized lenses
Intended to be imported qualified
import Generics.SOP.Lens as GLens
- data GLens r w a b
- lens :: r a b -> w (w b b, a) a -> GLens r w a b
- get :: GLens r w a b -> r a b
- modify :: GLens r w a b -> w (w b b, a) a
- set :: Arrow w => GLens r w a b -> w (b, a) a
- fromLens :: (Arrow r, ArrowApply w) => Lens (->) a b -> GLens r w a b
- fromIso :: (Arrow r, ArrowApply w) => Iso (->) a b -> GLens r w a b
- toLens :: GLens cat cat a b -> Lens cat a b
- glenses :: forall r w a xs. (Generic a, Code a ~ '[xs], Arrow r, ArrowApply w) => NP (GLens r w a) xs
- np :: forall r w xs. (Arrow r, ArrowApply w, SListI xs) => NP (GLens r w (NP I xs)) xs
- rep :: (Arrow r, ArrowApply w, Generic a) => GLens r w a (Rep a)
- sop :: (Arrow r, ArrowApply w) => GLens r w (SOP f '[xs]) (NP f xs)
- head :: (Arrow r, ArrowApply w) => GLens r w (NP f (x ': xs)) (f x)
- tail :: (Arrow r, ArrowApply w) => GLens r w (NP f (x ': xs)) (NP f xs)
- i :: (Arrow r, ArrowApply w) => GLens r w (I a) a
Generalized lenses
GLens generalizes a monomorphic lens by allowing for different categories for the getter and modifier
Conversion
Generic computation of lenses for record type
glenses :: forall r w a xs. (Generic a, Code a ~ '[xs], Arrow r, ArrowApply w) => NP (GLens r w a) xs Source #