Portability | Rank2Types |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Trustworthy |

- class (Functor f, Trustworthy 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, Trustworthy 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

Due to the structure of this library, if you built an illegal `Gettable`

instance that defined

, it would be possible to
produce code that would `coerce`

= `undefined`

`unsafeCoerce`

.

This would violate the promises of `SafeHaskell`

.

That said, the existing instances are all safe. To verify that any additional instances that *you* provide are safe, you must

import Control.Lens.Unsafe

and provide an instance of `Trustworthy`

for your data type. That module
does not make `SafeHaskell`

guarantees, so by doing so you've taken the
`SafeHaskell`

proof obligation into your own hands.

(Functor (Const r), Trustworthy (Const r)) => Gettable (Const r) | |

(Functor (Backwards f), Trustworthy (Backwards f), Gettable f) => Gettable (Backwards f) | |

(Functor (ElementOf f), Trustworthy (ElementOf f), Gettable f) => Gettable (ElementOf f) | |

(Functor (Accessor r), Trustworthy (Accessor r)) => Gettable (Accessor r) | |

(Functor (Indexing f), Trustworthy (Indexing f), Gettable f) => Gettable (Indexing f) | |

(Functor (Compose f g), Trustworthy (Compose f g), Functor f, Gettable g) => Gettable (Compose f g) | |

(Functor (Effect m r), Trustworthy (Effect m r)) => Gettable (Effect m r) | |

(Functor (BazaarT a b g), Trustworthy (BazaarT a b g), Gettable g) => Gettable (BazaarT a b g) | |

(Functor (EffectRWS w st m s), Trustworthy (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