| Portability | non-portable |
|---|---|
| Stability | provisional |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | Trustworthy |
Control.Lens.Internal.Getter
Contents
Description
- class Functor f => Gettable f where
- coerce :: f a -> f b
- noEffect :: (Applicative f, Gettable f) => f a
- newtype Accessor r a = Accessor {
- runAccessor :: r
Internal Classes
Getters
class Functor f => Gettable f whereSource
Generalizing Const so we can apply simple Applicative
transformations to it and so we can get nicer error messages.
A Gettable Functor ignores its argument, which it carries solely as a
phantom type parameter.
To ensure this, an instance of Gettable is required to satisfy:
id=fmapf =coerce
Which is equivalent to making a an "anyvariant"
Gettable fFunctor.
Instances
| Functor (Const r) => Gettable (Const r) | |
| (Functor (Backwards f), Gettable f) => Gettable (Backwards f) | |
| Functor (Accessor r) => Gettable (Accessor r) | |
| (Functor (Indexing64 f), Gettable f) => Gettable (Indexing64 f) | |
| (Functor (Indexing f), Gettable f) => Gettable (Indexing f) | |
| (Functor (Compose f g), Functor f, Gettable g) => Gettable (Compose f g) | |
| Functor (Effect m r) => Gettable (Effect m r) | |
| (Functor (PretextT p g a b), Profunctor p, Gettable g) => Gettable (PretextT p g a b) | |
| (Functor (BazaarT p g a b), Profunctor p, Gettable g) => Gettable (BazaarT p g a b) | |
| (Functor (TakingWhile p f a b), Gettable f) => Gettable (TakingWhile p f a b) | |
| Functor (EffectRWS w st m s) => Gettable (EffectRWS w st m s) |
noEffect :: (Applicative f, Gettable f) => f aSource
The mempty equivalent for a Gettable Applicative Functor.