Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
type
Setter' s a = Setter s s a alens Control.Lens.Combinators A Setter' is just a Setter that doesn't change the types. These are particularly common when talking about monomorphic containers. e.g.
sets Data.Text.map :: Setter' Text Char
type Setter' = Simple Setter
type
Setting (p :: Type -> Type -> Type) s t a b = p a Identity b -> s -> Identity tlens Control.Lens.Combinators This is a convenient alias when defining highly polymorphic code that takes both ASetter and AnIndexedSetter as appropriate. If a function takes this it is expecting one of those two things based on context.
type
Setting' (p :: Type -> Type -> Type) s a = Setting p s s a alens Control.Lens.Combinators This is a convenient alias when defining highly polymorphic code that takes both ASetter' and AnIndexedSetter' as appropriate. If a function takes this it is expecting one of those two things based on context.
module Control.Lens.Internal.
Setter No documentation available.
class (Applicative f, Distributive f, Traversable f) =>
Settable (f :: Type -> Type)lens Control.Lens.Internal.Setter Anything Settable must be isomorphic to the Identity Functor.
Setter :: Setter s t a b -> ReifiedSetter s t a blens Control.Lens.Reified No documentation available.
-
A Setter s t a b is a generalization of fmap from Functor. It allows you to map into a structure and change out the contents, but it isn't strong enough to allow you to enumerate those contents. Starting with fmap :: Functor f => (a -> b) -> f a -> f b we monomorphize the type to obtain (a -> b) -> s -> t and then decorate it with Identity to obtain:
type Setter s t a b = (a -> Identity b) -> s -> Identity t
Every Traversal is a valid Setter, since Identity is Applicative. Everything you can do with a Functor, you can do with a Setter. There are combinators that generalize fmap and (<$). class (Applicative f, Distributive f, Traversable f) =>
Settable (f :: Type -> Type)lens Control.Lens.Setter Anything Settable must be isomorphic to the Identity Functor.
type
Setter s t a b = forall (f :: Type -> Type) . Settable f => a -> f b -> s -> f tlens Control.Lens.Setter The only LensLike law that can apply to a Setter l is that
set l y (set l x a) ≡ set l y a
You can't view a Setter in general, so the other two laws are irrelevant. However, two Functor laws apply to a Setter:over l id ≡ id over l f . over l g ≡ over l (f . g)
These can be stated more directly:l pure ≡ pure l f . untainted . l g ≡ l (f . untainted . g)
You can compose a Setter with a Lens or a Traversal using (.) from the Prelude and the result is always only a Setter and nothing more.>>> over traverse f [a,b,c,d] [f a,f b,f c,f d]
>>> over _1 f (a,b) (f a,b)
>>> over (traverse._1) f [(a,b),(c,d)] [(f a,b),(f c,d)]
>>> over both f (a,b) (f a,f b)
>>> over (traverse.both) f [(a,b),(c,d)] [(f a,f b),(f c,f d)]
type
Setter' s a = Setter s s a alens Control.Lens.Setter A Setter' is just a Setter that doesn't change the types. These are particularly common when talking about monomorphic containers. e.g.
sets Data.Text.map :: Setter' Text Char
type Setter' = Simple Setter