ganeti

Ganeti.Lens

Description

Provides all lens-related functions.

Synopsis
• lensWith :: (s -> a) -> (s -> a -> b -> t) -> Lens s t a b
• makeCustomLenses :: Name -> Q [Dec]
• makeCustomLenses' :: Name -> [Name] -> Q [Dec]
• traverseOf2 :: Over (->) (Compose f g) s t a b -> (a -> f (g b)) -> s -> f (g t)
• mapMOf2 :: Over (->) (Compose (WrappedMonad m) g) s t a b -> (a -> m (g b)) -> s -> m (g t)
• atSet :: Ord a => a -> Lens' (Set a) Bool

# Documentation

lensWith :: (s -> a) -> (s -> a -> b -> t) -> Lens s t a b Source #

Creates an optimized lens where the setter also gets the original value from the getter.

makeCustomLenses :: Name -> Q [Dec] Source #

Create lenses for all fields of a given data type.

makeCustomLenses' :: Name -> [Name] -> Q [Dec] Source #

Create lenses for some fields of a given data type.

traverseOf2 :: Over (->) (Compose f g) s t a b -> (a -> f (g b)) -> s -> f (g t) Source #

Traverses over a composition of two functors. Most often the g functor is (,) r and traverseOf2 is used to traverse an effectful computation that also returns an additional output value.

mapMOf2 :: Over (->) (Compose (WrappedMonad m) g) s t a b -> (a -> m (g b)) -> s -> m (g t) Source #

Traverses over a composition of a monad and a functor. See traverseOf2.

atSet :: Ord a => a -> Lens' (Set a) Bool Source #

A helper lens over sets. While a similar lens exists in the package (as Lens' Set (Maybe ())), it's available only in most recent versions. And using Bool instead of Maybe () is more convenient.