Copyright | (C) 2017 Csongor Kiss |
---|---|
License | BSD3 |
Maintainer | Csongor Kiss <kiss.csongor.kiss@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Internal lens helpers. Only exported for Haddock
Synopsis
- type Lens s t a b = forall p. Strong p => p a b -> p s t
- type LensLike p s t a b = p a b -> p s t
- ravel :: (ALens a b a b -> ALens a b s t) -> Lens s t a b
- set :: ((a -> b) -> s -> t) -> (s, b) -> t
- view :: Lens s s a a -> s -> a
- withLensPrim :: Lens s t a b -> (forall c. (s -> (c, a)) -> ((c, b) -> t) -> r) -> r
- idLens :: ALens a b a b
- first :: Lens ((a :*: b) x) ((a' :*: b) x) (a x) (a' x)
- second :: Lens ((a :*: b) x) ((a :*: b') x) (b x) (b' x)
- fork :: (a -> b) -> (a -> c) -> a -> (b, c)
- swap :: (a, b) -> (b, a)
- cross :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
- data Coyoneda f b = Coyoneda (a -> b) (f a)
- inj :: Functor f => Coyoneda f a -> f a
- proj :: Functor f => f a -> Coyoneda f a
- newtype Alongside p s t a b = Alongside {
- getAlongside :: p (s, a) (t, b)
- (??) :: Functor f => f (a -> b) -> a -> f b
- alongside :: Profunctor p => LensLike (Alongside p s' t') s t a b -> LensLike (Alongside p a b) s' t' a' b' -> LensLike p (s, s') (t, t') (a, a') (b, b')
- assoc3L :: Lens ((a, b), c) ((a', b'), c') (a, (b, c)) (a', (b', c'))
- stron :: (Either s s', b) -> Either (s, b) (s', b)
- choosing :: forall s t a b s' t'. Lens s t a b -> Lens s' t' a b -> Lens (Either s s') (Either t t') a b
- lens :: (s -> (c, a)) -> ((c, b) -> t) -> Lens s t a b
- data ALens a b s t = ALens (s -> (c, a)) ((c, b) -> t)
- mLens :: Lens (M1 i c f p) (M1 i c g p) (f p) (g p)
- repLens :: (Generic a, Generic b) => Lens a b (Rep a x) (Rep b x)
- prodL :: Lens ((a :*: b) x) ((a' :*: b') x) (a x, b x) (a' x, b' x)
- prodR :: Lens (a' x, b' x) (a x, b x) ((a' :*: b') x) ((a :*: b) x)
- assoc3R :: Lens (a', (b', c')) (a, (b, c)) ((a', b'), c') ((a, b), c)
Documentation
withLensPrim :: Lens s t a b -> (forall c. (s -> (c, a)) -> ((c, b) -> t) -> r) -> r Source #
first :: Lens ((a :*: b) x) ((a' :*: b) x) (a x) (a' x) Source #
Lens focusing on the first element of a product
second :: Lens ((a :*: b) x) ((a :*: b') x) (b x) (b' x) Source #
Lens focusing on the second element of a product
Coyoneda (a -> b) (f a) |
newtype Alongside p s t a b Source #
Alongside | |
|
Instances
Strong p => Strong (Alongside p c d) Source # | |
Profunctor p => Profunctor (Alongside p c d) Source # | |
Defined in Data.Generics.Internal.Profunctor.Lens dimap :: (a -> b) -> (c0 -> d0) -> Alongside p c d b c0 -> Alongside p c d a d0 # lmap :: (a -> b) -> Alongside p c d b c0 -> Alongside p c d a c0 # rmap :: (b -> c0) -> Alongside p c d a b -> Alongside p c d a c0 # (#.) :: Coercible c0 b => q b c0 -> Alongside p c d a b -> Alongside p c d a c0 # (.#) :: Coercible b a => Alongside p c d b c0 -> q a b -> Alongside p c d a c0 # |
alongside :: Profunctor p => LensLike (Alongside p s' t') s t a b -> LensLike (Alongside p a b) s' t' a' b' -> LensLike p (s, s') (t, t') (a, a') (b, b') Source #
choosing :: forall s t a b s' t'. Lens s t a b -> Lens s' t' a b -> Lens (Either s s') (Either t t') a b Source #
ALens (s -> (c, a)) ((c, b) -> t) |
Instances
Strong (ALens a b) Source # | |
Profunctor (ALens a b) Source # | |
Defined in Data.Generics.Internal.Profunctor.Lens dimap :: (a0 -> b0) -> (c -> d) -> ALens a b b0 c -> ALens a b a0 d # lmap :: (a0 -> b0) -> ALens a b b0 c -> ALens a b a0 c # rmap :: (b0 -> c) -> ALens a b a0 b0 -> ALens a b a0 c # (#.) :: Coercible c b0 => q b0 c -> ALens a b a0 b0 -> ALens a b a0 c # (.#) :: Coercible b0 a0 => ALens a b b0 c -> q a0 b0 -> ALens a b a0 c # | |
Functor (ALens a b s) Source # | |