| Portability | Rank2Types |
|---|---|
| Stability | provisional |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | Trustworthy |
Control.Lens.Internal
Description
These are some of the explicit Functor instances that leak into the type signatures of Control.Lens. You shouldn't need to import this module directly, unless you are coming up with a whole new kind of "Family" and need to add instances.
- const# :: (a -> b) -> a -> Const b r
- getConst# :: (a -> Const b r) -> a -> b
- zipList# :: (a -> [b]) -> a -> ZipList b
- getZipList# :: (a -> ZipList b) -> a -> [b]
- wrapMonad# :: (a -> m b) -> a -> WrappedMonad m b
- unwrapMonad# :: (a -> WrappedMonad m b) -> a -> m b
- last# :: (a -> Maybe b) -> a -> Last b
- getLast# :: (a -> Last b) -> a -> Maybe b
- first# :: (a -> Maybe b) -> a -> First b
- getFirst# :: (a -> First b) -> a -> Maybe b
- product# :: (a -> b) -> a -> Product b
- getProduct# :: (a -> Product b) -> a -> b
- sum# :: (a -> b) -> a -> Sum b
- getSum# :: (a -> Sum b) -> a -> b
- any# :: (a -> Bool) -> a -> Any
- getAny# :: (a -> Any) -> a -> Bool
- all# :: (a -> Bool) -> a -> All
- getAll# :: (a -> All) -> a -> Bool
- dual# :: (a -> b) -> a -> Dual b
- getDual# :: (a -> Dual b) -> a -> b
- endo# :: (a -> b -> b) -> a -> Endo b
- appEndo# :: (a -> Endo b) -> a -> b -> b
- may# :: (a -> Maybe b) -> a -> May b
- getMay# :: (a -> May b) -> a -> Maybe b
- folding# :: (a -> f b) -> a -> Folding f b
- getFolding# :: (a -> Folding f b) -> a -> f b
- effect# :: (a -> m r) -> a -> Effect m r b
- getEffect# :: (a -> Effect m r b) -> a -> m r
- effectRWS# :: (a -> st -> m (s, st, w)) -> a -> EffectRWS w st m s b
- getEffectRWS# :: (a -> EffectRWS w st m s b) -> a -> st -> m (s, st, w)
- accessor# :: (a -> r) -> a -> Accessor r b
- runAccessor# :: (a -> Accessor r b) -> a -> r
- err# :: (a -> Either e b) -> a -> Err e b
- getErr# :: (a -> Err e b) -> a -> Either e b
- traversed# :: (a -> f ()) -> a -> Traversed f
- getTraversed# :: (a -> Traversed f) -> a -> f ()
- sequenced# :: (a -> f ()) -> a -> Sequenced f
- getSequenced# :: (a -> Sequenced f) -> a -> f ()
- focusing# :: (a -> m (s, b)) -> a -> Focusing m s b
- unfocusing# :: (a -> Focusing m s b) -> a -> m (s, b)
- focusingWith# :: (a -> m (s, b, w)) -> a -> FocusingWith w m s b
- unfocusingWith# :: (a -> FocusingWith w m s b) -> a -> m (s, b, w)
- focusingPlus# :: (a -> k (s, w) b) -> a -> FocusingPlus w k s b
- unfocusingPlus# :: (a -> FocusingPlus w k s b) -> a -> k (s, w) b
- focusingOn# :: (a -> k (f s) b) -> a -> FocusingOn f k s b
- unfocusingOn# :: (a -> FocusingOn f k s b) -> a -> k (f s) b
- focusingMay# :: (a -> k (May s) b) -> a -> FocusingMay k s b
- unfocusingMay# :: (a -> FocusingMay k s b) -> a -> k (May s) b
- focusingErr# :: (a -> k (Err e s) b) -> a -> FocusingErr e k s b
- unfocusingErr# :: (a -> FocusingErr e k s b) -> a -> k (Err e s) b
- bazaar# :: (forall f. Applicative f => a -> (c -> f d) -> f t) -> a -> Bazaar c d t
- runBazaar# :: Applicative f => (a -> Bazaar c d t) -> a -> (c -> f d) -> f t
- mutator# :: (a -> b) -> a -> Mutator b
- runMutator# :: (a -> Mutator b) -> a -> b
- backwards# :: (a -> f b) -> a -> Backwards f b
- forwards# :: (a -> Backwards f b) -> a -> f b
- newtype Focusing m s a = Focusing {
- unfocusing :: m (s, a)
- newtype FocusingWith w m s a = FocusingWith {
- unfocusingWith :: m (s, a, w)
- newtype FocusingPlus w k s a = FocusingPlus {
- unfocusingPlus :: k (s, w) a
- newtype FocusingOn f k s a = FocusingOn {
- unfocusingOn :: k (f s) a
- newtype May a = May {}
- newtype FocusingMay k s a = FocusingMay {
- unfocusingMay :: k (May s) a
- newtype Err e a = Err {}
- newtype FocusingErr e k s a = FocusingErr {
- unfocusingErr :: k (Err e s) a
- data IndexingResult f a = IndexingResult (f a) !Int
- newtype Indexing f a = Indexing {
- runIndexing :: Int -> IndexingResult f a
- newtype Traversed f = Traversed {
- getTraversed :: f ()
- newtype Sequenced m = Sequenced {
- getSequenced :: m ()
- data Min a
- getMin :: Min a -> Maybe a
- data Max a
- getMax :: Max a -> Maybe a
- data Context a b t = Context (b -> t) a
- newtype Bazaar a b t = Bazaar {
- runBazaar :: forall f. Applicative f => (a -> f b) -> f t
- bazaar :: Applicative f => (a -> f b) -> Bazaar a b t -> f t
- duplicateBazaar :: Bazaar a c t -> Bazaar a b (Bazaar b c t)
- sell :: a -> Bazaar a b b
- newtype Effect m r a = Effect {
- getEffect :: m r
- newtype EffectRWS w st m s a = EffectRWS {
- getEffectRWS :: st -> m (s, st, w)
- class Functor f => Gettable f where
- coerce :: f a -> f b
- newtype Accessor r a = Accessor {
- runAccessor :: r
- 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)
- newtype Folding f a = Folding {
- getFolding :: f a
- noEffect :: (Applicative f, Gettable f) => f a
- class Applicative f => Settable f where
- untainted :: f a -> a
- untainted# :: (b -> f a) -> b -> a
- newtype Mutator a = Mutator {
- runMutator :: a
- data Level a = Level !Int [a] a [a]
- levelWidth :: Level a -> Int
- leftLevel :: Level a -> Maybe (Level a)
- left1Level :: Level a -> Level a
- leftmostLevel :: Level a -> Level a
- rightmostLevel :: Level a -> Level a
- rightLevel :: Level a -> Maybe (Level a)
- right1Level :: Level a -> Level a
- focusLevel :: Functor f => (a -> f a) -> Level a -> f (Level a)
- rezipLevel :: Level a -> NonEmpty a
Documentation
getZipList# :: (a -> ZipList b) -> a -> [b]Source
wrapMonad# :: (a -> m b) -> a -> WrappedMonad m bSource
unwrapMonad# :: (a -> WrappedMonad m b) -> a -> m bSource
getProduct# :: (a -> Product b) -> a -> bSource
getFolding# :: (a -> Folding f b) -> a -> f bSource
getEffect# :: (a -> Effect m r b) -> a -> m rSource
effectRWS# :: (a -> st -> m (s, st, w)) -> a -> EffectRWS w st m s bSource
getEffectRWS# :: (a -> EffectRWS w st m s b) -> a -> st -> m (s, st, w)Source
runAccessor# :: (a -> Accessor r b) -> a -> rSource
traversed# :: (a -> f ()) -> a -> Traversed fSource
getTraversed# :: (a -> Traversed f) -> a -> f ()Source
sequenced# :: (a -> f ()) -> a -> Sequenced fSource
getSequenced# :: (a -> Sequenced f) -> a -> f ()Source
unfocusing# :: (a -> Focusing m s b) -> a -> m (s, b)Source
focusingWith# :: (a -> m (s, b, w)) -> a -> FocusingWith w m s bSource
unfocusingWith# :: (a -> FocusingWith w m s b) -> a -> m (s, b, w)Source
focusingPlus# :: (a -> k (s, w) b) -> a -> FocusingPlus w k s bSource
unfocusingPlus# :: (a -> FocusingPlus w k s b) -> a -> k (s, w) bSource
focusingOn# :: (a -> k (f s) b) -> a -> FocusingOn f k s bSource
unfocusingOn# :: (a -> FocusingOn f k s b) -> a -> k (f s) bSource
focusingMay# :: (a -> k (May s) b) -> a -> FocusingMay k s bSource
unfocusingMay# :: (a -> FocusingMay k s b) -> a -> k (May s) bSource
focusingErr# :: (a -> k (Err e s) b) -> a -> FocusingErr e k s bSource
unfocusingErr# :: (a -> FocusingErr e k s b) -> a -> k (Err e s) bSource
bazaar# :: (forall f. Applicative f => a -> (c -> f d) -> f t) -> a -> Bazaar c d tSource
runBazaar# :: Applicative f => (a -> Bazaar c d t) -> a -> (c -> f d) -> f tSource
runMutator# :: (a -> Mutator b) -> a -> bSource
backwards# :: (a -> f b) -> a -> Backwards f bSource
Constructors
| Focusing | |
Fields
| |
Instances
| Monad m => Functor (Focusing m s) | |
| (Functor (Focusing m s), Monad m, Monoid s) => Applicative (Focusing m s) | |
| (MonadState s (StateT s z), MonadState t (StateT t z), Monad z) => Zoom (StateT s z) (StateT t z) (Focusing z) s t | |
| (MonadState s (StateT s z), MonadState t (StateT t z), Monad z) => Zoom (StateT s z) (StateT t z) (Focusing z) s t |
newtype FocusingWith w m s a Source
Constructors
| FocusingWith | |
Fields
| |
Instances
| Monad m => Functor (FocusingWith w m s) | |
| (Functor (FocusingWith w m s), Monad m, Monoid s, Monoid w) => Applicative (FocusingWith w m s) | |
| (MonadState s (RWST r w s z), MonadState t (RWST r w t z), Monoid w, Monad z) => Zoom (RWST r w s z) (RWST r w t z) (FocusingWith w z) s t | |
| (MonadState s (RWST r w s z), MonadState t (RWST r w t z), Monoid w, Monad z) => Zoom (RWST r w s z) (RWST r w t z) (FocusingWith w z) s t |
newtype FocusingPlus w k s a Source
Constructors
| FocusingPlus | |
Fields
| |
Instances
| (MonadState s (WriterT w m), MonadState t (WriterT w n), Monoid w, Zoom m n k s t) => Zoom (WriterT w m) (WriterT w n) (FocusingPlus w k) s t | |
| (MonadState s (WriterT w m), MonadState t (WriterT w n), Monoid w, Zoom m n k s t) => Zoom (WriterT w m) (WriterT w n) (FocusingPlus w k) s t | |
| Functor (k (s, w)) => Functor (FocusingPlus w k s) | |
| (Functor (FocusingPlus w k s), Monoid w, Applicative (k (s, w))) => Applicative (FocusingPlus w k s) |
newtype FocusingOn f k s a Source
Constructors
| FocusingOn | |
Fields
| |
Instances
| (MonadState s (ListT m), MonadState t (ListT n), Zoom m n k s t) => Zoom (ListT m) (ListT n) (FocusingOn [] k) s t | |
| Functor (k (f s)) => Functor (FocusingOn f k s) | |
| (Functor (FocusingOn f k s), Applicative (k (f s))) => Applicative (FocusingOn f k s) |
Make a monoid out of Maybe for error handling
newtype FocusingMay k s a Source
Constructors
| FocusingMay | |
Fields
| |
Instances
| (MonadState s (MaybeT m), MonadState t (MaybeT n), Zoom m n k s t) => Zoom (MaybeT m) (MaybeT n) (FocusingMay k) s t | |
| Functor (k (May s)) => Functor (FocusingMay k s) | |
| (Functor (FocusingMay k s), Applicative (k (May s))) => Applicative (FocusingMay k s) |
Make a monoid out of Either for error handling
newtype FocusingErr e k s a Source
Constructors
| FocusingErr | |
Fields
| |
Instances
| (MonadState s (ErrorT e m), MonadState t (ErrorT e n), Error e, Zoom m n k s t) => Zoom (ErrorT e m) (ErrorT e n) (FocusingErr e k) s t | |
| Functor (k (Err e s)) => Functor (FocusingErr e k s) | |
| (Functor (FocusingErr e k s), Applicative (k (Err e s))) => Applicative (FocusingErr e k s) |
data IndexingResult f a Source
The result of Indexing
Constructors
| IndexingResult (f a) !Int |
Instances
| Functor f => Functor (IndexingResult f) |
Constructors
| Indexing | |
Fields
| |
Used internally by traverseOf_ and the like.
Constructors
| Traversed | |
Fields
| |
Instances
| Applicative f => Monoid (Traversed f) |
Used internally by mapM_ and the like.
Constructors
| Sequenced | |
Fields
| |
The indexed store can be used to characterize a Lens
and is used by clone
is isomorphic to
Context a b tnewtype Context a b t = Context { runContext :: forall f. Functor f => (a -> f b) -> f t },
and to exists s. (s, .
Lens s t a b)
A Context is like a Lens that has already been applied to a some structure.
Constructors
| Context (b -> t) a |
This is used to characterize a Traversal.
a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.
http://twanvl.nl/blog/haskell/non-regular1
is isomorphic to Bazaar a b tdata Bazaar a b t = Buy t | Trade (Bazaar a b (b -> t)) a,
and to exists s. (s, .
Traversal s t a b)
A Bazaar is like a Traversal that has already been applied to some structure.
Where a holds an Context a b ta and a function from b to
t, a holds N Bazaar a b tas and a function from N
bs to t.
Mnemonically, a Bazaar holds many stores and you can easily add more.
This is a final encoding of Bazaar.
Constructors
| Bazaar | |
Fields
| |
bazaar :: Applicative f => (a -> f b) -> Bazaar a b t -> f tSource
Wrap a monadic effect with a phantom type argument.
Instances
| (Gettable (Effect m r), Monad m) => Effective m r (Effect m r) | |
| Functor (Effect m r) | |
| (Functor (Effect m r), Monad m, Monoid r) => Applicative (Effect m r) | |
| Functor (Effect m r) => Gettable (Effect m r) | |
| (MonadReader b (ReaderT b m), MonadReader a (ReaderT a m), Monad m) => Magnify (ReaderT b m) (ReaderT a m) (Effect m) b a | |
| (Monad m, Monoid r) => Monoid (Effect m r a) |
newtype EffectRWS w st m s a Source
Wrap a monadic effect with a phantom type argument. Used when magnifying RWST.
Constructors
| EffectRWS | |
Fields
| |
Instances
| Functor (EffectRWS w st m s) | |
| (Functor (EffectRWS w st m s), Monoid s, Monoid w, Monad m) => Applicative (EffectRWS w st m s) | |
| Functor (EffectRWS w st m s) => Gettable (EffectRWS w st m s) | |
| (MonadReader b (RWST b w s m), MonadReader a (RWST a w s m), Monad m, Monoid w) => Magnify (RWST b w s m) (RWST a w s m) (EffectRWS w s m) b a | |
| (MonadReader b (RWST b w s m), MonadReader a (RWST a w s m), Monad m, Monoid w) => Magnify (RWST b w s m) (RWST a w s m) (EffectRWS w s m) b a |
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
Instances
| 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 (EffectRWS w st m s) => Gettable (EffectRWS w st m s) |
Used instead of Const to report
No instance of (SettableAccessor)
when the user attempts to misuse a Setter as a
Getter, rather than a monolithic unification error.
Constructors
| Accessor | |
Fields
| |
Instances
| (Monad Identity, Gettable (Accessor r)) => Effective Identity r (Accessor r) | |
| Functor (Accessor r) | |
| (Functor (Accessor r), Monoid r) => Applicative (Accessor r) | |
| Functor (Accessor r) => Gettable (Accessor r) | |
| (MonadReader b ((->) b), MonadReader a ((->) a)) => Magnify ((->) b) ((->) a) Accessor b a |
|
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.
Methods
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.
A Monoid for a Gettable Applicative.
Constructors
| Folding | |
Fields
| |
Instances
| (Gettable f, Applicative f) => Monoid (Folding f a) |
noEffect :: (Applicative f, Gettable f) => f aSource
The mempty equivalent for a Gettable Applicative Functor.
class Applicative f => Settable f whereSource
Mutator is just a renamed Identity functor to give better error
messages when someone attempts to use a getter as a setter.
Most user code will never need to see this type.
Constructors
| Mutator | |
Fields
| |
A basic non-empty list zipper
All combinators assume the invariant that the length stored matches the number of elements in list of items to the left, and the list of items to the left is stored reversed.
levelWidth :: Level a -> IntSource
How many entries are there in this level?
left1Level :: Level a -> Level aSource
Pull the non-empty list zipper left one entry, stopping at the first entry.
leftmostLevel :: Level a -> Level aSource
Pull the non-empty list zipper all the way to the left.
rightmostLevel :: Level a -> Level aSource
Pul the non-empty list zipper all the way to the right. NB:, when given an infinite list this may not terminate.
rightLevel :: Level a -> Maybe (Level a)Source
Pull the non-empty list zipper right one entry.
right1Level :: Level a -> Level aSource
Pull the non-empty list zipper right one entry, stopping at the last entry.
focusLevel :: Functor f => (a -> f a) -> Level a -> f (Level a)Source
This is a Lens targeting the value that we would extract from the non-empty list zipper.
viewfocusLevel≡extract
focusLevel::SimpleLens(Levela) a
rezipLevel :: Level a -> NonEmpty aSource
Zip a non-empty list zipper back up, and return the result.