Portability | non-portable |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Trustworthy |
- 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
=fmap
f =coerce
Which is equivalent to making a
an "anyvariant"
Gettable
fFunctor
.
Gettable (Const r) | |
Gettable f => Gettable (Backwards f) | |
Gettable (Accessor r) | |
Gettable f => Gettable (Indexing64 f) | |
Gettable f => Gettable (Indexing f) | |
(Functor f, Gettable g) => Gettable (Compose f g) | |
Gettable (Effect m r) | |
(Profunctor p, Gettable g) => Gettable (PretextT p g a b) | |
(Profunctor p, Gettable g) => Gettable (BazaarT p g a b) | |
Gettable f => Gettable (TakingWhile p f a b) | |
Gettable (EffectRWS w st m s) |
noEffect :: (Applicative f, Gettable f) => f aSource
The mempty
equivalent for a Gettable
Applicative
Functor
.