Portability | Rank2Types |
---|---|
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
- class (Monad m, Gettable f) => Effective m r f | f -> m r where
- effective :: Isomorphic k => k (m r) (f a)
- ineffective :: Effective m r f => Isomorphic k => k (f a) (m r)
- class Applicative f => Settable f where
- untainted :: f a -> a
- untainted# :: (a -> f b) -> a -> b
- tainted# :: (a -> b) -> a -> f b
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" functor.
Gettable
f
Functor (Const r) => Gettable (Const r) | |
(Functor (Backwards f), Gettable f) => Gettable (Backwards f) | |
Functor (Accessor r) => Gettable (Accessor r) | |
(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 (BazaarT a b g), Gettable g) => Gettable (BazaarT a b g) | |
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
.
Actions
class (Monad m, Gettable f) => Effective m r f | f -> m r whereSource
An Effective
Functor
ignores its argument and is isomorphic to a monad wrapped around a value.
That said, the monad is possibly rather unrelated to any Applicative
structure.
effective :: Isomorphic k => k (m r) (f a)Source
ineffective :: Effective m r f => Isomorphic k => k (f a) (m r)Source
A convenient antonym that is used internally.
Setters
class Applicative f => Settable f whereSource
untainted# :: (a -> f b) -> a -> bSource