lens-4.13: Lenses, Folds and Traversals

Copyright | (C) 2012-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | Safe
Language | Haskell98

Control.Lens.Internal.Zoom

Contents

- Zoom
- Magnify

Description

Synopsis

- type family Zoomed m :: * -> * -> *
- 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 FocusingMay k s a = FocusingMay {
  - unfocusingMay :: k (May s) a
  }
- newtype May a = May {
  - getMay :: Maybe a
  }
- newtype FocusingErr e k s a = FocusingErr {
  - unfocusingErr :: k (Err e s) a
  }
- newtype Err e a = Err {
  - getErr :: Either e a
  }
- type family Magnified m :: * -> * -> *
- newtype Effect m r a = Effect {
  - getEffect :: m r
  }
- newtype EffectRWS w st m s a = EffectRWS {
  - getEffectRWS :: st -> m (s, st, w)
  }

# Zoom

type family Zoomed m :: * -> * -> * Source

This type family is used by `Zoom` to describe the common effect type.

Instances

type Zoomed (IdentityT m) = Zoomed m Source |
type Zoomed (ListT m) = FocusingOn [] (Zoomed m) Source |
type Zoomed (MaybeT m) = FocusingMay (Zoomed m) Source |
type Zoomed (ReaderT e m) = Zoomed m Source |
type Zoomed (StateT s z) = Focusing z Source |
type Zoomed (StateT s z) = Focusing z Source |
type Zoomed (ExceptT e m) = FocusingErr e (Zoomed m) Source |
type Zoomed (ErrorT e m) = FocusingErr e (Zoomed m) Source |
type Zoomed (WriterT w m) = FocusingPlus w (Zoomed m) Source |
type Zoomed (WriterT w m) = FocusingPlus w (Zoomed m) Source |
type Zoomed (RWST r w s z) = FocusingWith w z Source |
type Zoomed (RWST r w s z) = FocusingWith w z Source |

newtype Focusing m s a Source

Used by `Zoom` to `zoom` into `StateT`.

Constructors

Focusing |

Fields

unfocusing :: m (s, a)

Instances

Monad m => Functor (Focusing m s) Source |
(Monad m, Monoid s) => Applicative (Focusing m s) Source |
(Monad m, Semigroup s) => Apply (Focusing m s) Source |

newtype FocusingWith w m s a Source

Used by `Zoom` to `zoom` into `RWST`.

Constructors

FocusingWith |

Fields

unfocusingWith :: m (s, a, w)

Instances

Monad m => Functor (FocusingWith w m s) Source |
(Monad m, Monoid s, Monoid w) => Applicative (FocusingWith w m s) Source |
(Monad m, Semigroup s, Semigroup w) => Apply (FocusingWith w m s) Source |

newtype FocusingPlus w k s a Source

Used by `Zoom` to `zoom` into `WriterT`.

Constructors

FocusingPlus |

Fields

unfocusingPlus :: k (s, w) a

Instances

Functor (k (s, w)) => Functor (FocusingPlus w k s) Source |
Applicative (k (s, w)) => Applicative (FocusingPlus w k s) Source |
Apply (k (s, w)) => Apply (FocusingPlus w k s) Source |

newtype FocusingOn f k s a Source

Used by `Zoom` to `zoom` into `MaybeT` or `ListT`.

Constructors

FocusingOn |

Fields

unfocusingOn :: k (f s) a

Instances

Functor (k (f s)) => Functor (FocusingOn f k s) Source |
Applicative (k (f s)) => Applicative (FocusingOn f k s) Source |
Apply (k (f s)) => Apply (FocusingOn f k s) Source |

newtype FocusingMay k s a Source

Used by `Zoom` to `zoom` into `ErrorT`.

Constructors

FocusingMay |

Fields

unfocusingMay :: k (May s) a

Instances

Functor (k (May s)) => Functor (FocusingMay k s) Source |
Applicative (k (May s)) => Applicative (FocusingMay k s) Source |
Apply (k (May s)) => Apply (FocusingMay k s) Source |

newtype May a Source

Make a `Monoid` out of `Maybe` for error handling.

Constructors

May |

Fields

getMay :: Maybe a

Instances

Monoid a => Monoid (May a) Source |
Semigroup a => Semigroup (May a) Source |

newtype FocusingErr e k s a Source

Used by `Zoom` to `zoom` into `ErrorT`.

Constructors

FocusingErr |

Fields

unfocusingErr :: k (Err e s) a

Instances

Functor (k (Err e s)) => Functor (FocusingErr e k s) Source |
Applicative (k (Err e s)) => Applicative (FocusingErr e k s) Source |
Apply (k (Err e s)) => Apply (FocusingErr e k s) Source |

newtype Err e a Source

Make a `Monoid` out of `Either` for error handling.

Constructors

Err |

Fields

getErr :: Either e a

Instances

Monoid a => Monoid (Err e a) Source |
Semigroup a => Semigroup (Err e a) Source |

# Magnify

type family Magnified m :: * -> * -> * Source

This type family is used by `Magnify` to describe the common effect type.

Instances

type Magnified ((->) b) = Const Source |
type Magnified (IdentityT m) = Magnified m Source |
type Magnified (ReaderT b m) = Effect m Source |
type Magnified (RWST a w s m) = EffectRWS w s m Source |
type Magnified (RWST a w s m) = EffectRWS w s m Source |

newtype Effect m r a Source

Wrap a monadic effect with a phantom type argument.

Constructors

Effect |

Fields

getEffect :: m r

Instances

Functor (Effect m r) Source |
(Monad m, Monoid r) => Applicative (Effect m r) Source |
Contravariant (Effect m r) Source |
(Apply m, Semigroup r) => Apply (Effect m r) Source |
(Monad m, Monoid r) => Monoid (Effect m r a) Source |
(Apply m, Semigroup r) => Semigroup (Effect m r a) Source |

newtype EffectRWS w st m s a Source

Wrap a monadic effect with a phantom type argument. Used when magnifying `RWST`.

Constructors

EffectRWS |

Fields

getEffectRWS :: st -> m (s, st, w)

Instances

Functor (EffectRWS w st m s) Source |
(Monoid s, Monoid w, Monad m) => Applicative (EffectRWS w st m s) Source |
Contravariant (EffectRWS w st m s) Source |
(Semigroup s, Semigroup w, Bind m) => Apply (EffectRWS w st m s) Source |