{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Plots.Axis.Grid
(
GridLines
, HasGridLines (..)
, MajorGridLines
, HasMajorGridLines (..)
, MinorGridLines
, HasMinorGridLines (..)
, gridLinesStyle
, gridLinesVisible
, hideGridLines
, showGridLines
, GridLineFunction
, onTicksGridLineFunction
, emptyGridLineFunction
) where
import Control.Lens hiding (( # ))
import Data.Data
import Data.Default
import Control.Monad.State
import Diagrams.Prelude
import Plots.Types
type GridLineFunction n = [n] -> (n, n) -> [n]
data MajorGridLines v n = MajorGridLines
{ forall (v :: * -> *) n. MajorGridLines v n -> GridLineFunction n
magFun :: GridLineFunction n
, forall (v :: * -> *) n. MajorGridLines v n -> Style v n
magStyle :: Style v n
, forall (v :: * -> *) n. MajorGridLines v n -> Bool
magVisible :: Bool
} deriving Typeable
type instance V (MajorGridLines v n) = v
type instance N (MajorGridLines v n) = n
class HasMajorGridLines f a where
majorGridLines :: LensLike' f a (MajorGridLines (V a) (N a))
majorGridLinesFunction :: Functor f => LensLike' f a (GridLineFunction (N a))
majorGridLinesFunction = LensLike' f a (MajorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines LensLike' f a (MajorGridLines (V a) (N a))
-> ((GridLineFunction (N a) -> f (GridLineFunction (N a)))
-> MajorGridLines (V a) (N a) -> f (MajorGridLines (V a) (N a)))
-> LensLike' f a (GridLineFunction (N a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MajorGridLines (V a) (N a) -> GridLineFunction (N a))
-> (MajorGridLines (V a) (N a)
-> GridLineFunction (N a) -> MajorGridLines (V a) (N a))
-> Lens
(MajorGridLines (V a) (N a))
(MajorGridLines (V a) (N a))
(GridLineFunction (N a))
(GridLineFunction (N a))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MajorGridLines (V a) (N a) -> GridLineFunction (N a)
forall (v :: * -> *) n. MajorGridLines v n -> GridLineFunction n
magFun (\MajorGridLines (V a) (N a)
gl GridLineFunction (N a)
maf -> MajorGridLines (V a) (N a)
gl {magFun :: GridLineFunction (N a)
magFun = GridLineFunction (N a)
maf})
majorGridLinesStyle :: Functor f => LensLike' f a (Style (V a) (N a))
majorGridLinesStyle = LensLike' f a (MajorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines LensLike' f a (MajorGridLines (V a) (N a))
-> ((Style (V a) (N a) -> f (Style (V a) (N a)))
-> MajorGridLines (V a) (N a) -> f (MajorGridLines (V a) (N a)))
-> LensLike' f a (Style (V a) (N a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MajorGridLines (V a) (N a) -> Style (V a) (N a))
-> (MajorGridLines (V a) (N a)
-> Style (V a) (N a) -> MajorGridLines (V a) (N a))
-> Lens
(MajorGridLines (V a) (N a))
(MajorGridLines (V a) (N a))
(Style (V a) (N a))
(Style (V a) (N a))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MajorGridLines (V a) (N a) -> Style (V a) (N a)
forall (v :: * -> *) n. MajorGridLines v n -> Style v n
magStyle (\MajorGridLines (V a) (N a)
gl Style (V a) (N a)
sty -> MajorGridLines (V a) (N a)
gl {magStyle :: Style (V a) (N a)
magStyle = Style (V a) (N a)
sty})
instance HasMajorGridLines f (MajorGridLines v n) where
majorGridLines :: LensLike'
f
(MajorGridLines v n)
(MajorGridLines (V (MajorGridLines v n)) (N (MajorGridLines v n)))
majorGridLines = LensLike'
f
(MajorGridLines v n)
(MajorGridLines (V (MajorGridLines v n)) (N (MajorGridLines v n)))
forall a. a -> a
id
instance (Typeable n, Floating n) => Default (MajorGridLines v n) where
def :: MajorGridLines v n
def = MajorGridLines
{ magFun :: GridLineFunction n
magFun = GridLineFunction n
forall n. GridLineFunction n
onTicksGridLineFunction
, magStyle :: Style v n
magStyle = Style v n
forall a. Monoid a => a
mempty Style v n -> (Style v n -> Style v n) -> Style v n
forall a b. a -> (a -> b) -> b
# n -> Style v n -> Style v n
forall a n. (N a ~ n, HasStyle a, Typeable n) => n -> a -> a
lwO n
0.8
, magVisible :: Bool
magVisible = Bool
True
}
instance HasVisibility (MajorGridLines v n) where
visible :: Lens' (MajorGridLines v n) Bool
visible = (MajorGridLines v n -> Bool)
-> (MajorGridLines v n -> Bool -> MajorGridLines v n)
-> Lens' (MajorGridLines v n) Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MajorGridLines v n -> Bool
forall (v :: * -> *) n. MajorGridLines v n -> Bool
magVisible (\MajorGridLines v n
gl Bool
b -> MajorGridLines v n
gl {magVisible :: Bool
magVisible = Bool
b})
instance Typeable n => HasStyle (MajorGridLines v n) where
applyStyle :: Style (V (MajorGridLines v n)) (N (MajorGridLines v n))
-> MajorGridLines v n -> MajorGridLines v n
applyStyle Style (V (MajorGridLines v n)) (N (MajorGridLines v n))
s = (Style v n -> Identity (Style v n))
-> MajorGridLines v n -> Identity (MajorGridLines v n)
forall (f :: * -> *) a.
(HasMajorGridLines f a, Functor f) =>
LensLike' f a (Style (V a) (N a))
majorGridLinesStyle ((Style v n -> Identity (Style v n))
-> MajorGridLines v n -> Identity (MajorGridLines v n))
-> (Style v n -> Style v n)
-> MajorGridLines v n
-> MajorGridLines v n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Style (V (Style v n)) (N (Style v n)) -> Style v n -> Style v n
forall a. HasStyle a => Style (V a) (N a) -> a -> a
applyStyle Style (V (Style v n)) (N (Style v n))
Style (V (MajorGridLines v n)) (N (MajorGridLines v n))
s
data MinorGridLines v n = MinorGridLines
{ forall (v :: * -> *) n. MinorGridLines v n -> GridLineFunction n
migFun :: GridLineFunction n
, forall (v :: * -> *) n. MinorGridLines v n -> Style v n
migStyle :: Style v n
, forall (v :: * -> *) n. MinorGridLines v n -> Bool
migVisible :: Bool
} deriving Typeable
type instance V (MinorGridLines v n) = v
type instance N (MinorGridLines v n) = n
class HasMinorGridLines f a where
minorGridLines :: LensLike' f a (MinorGridLines (V a) (N a))
minorGridLinesFunction :: Functor f => LensLike' f a (GridLineFunction (N a))
minorGridLinesFunction = LensLike' f a (MinorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines LensLike' f a (MinorGridLines (V a) (N a))
-> ((GridLineFunction (N a) -> f (GridLineFunction (N a)))
-> MinorGridLines (V a) (N a) -> f (MinorGridLines (V a) (N a)))
-> LensLike' f a (GridLineFunction (N a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MinorGridLines (V a) (N a) -> GridLineFunction (N a))
-> (MinorGridLines (V a) (N a)
-> GridLineFunction (N a) -> MinorGridLines (V a) (N a))
-> Lens
(MinorGridLines (V a) (N a))
(MinorGridLines (V a) (N a))
(GridLineFunction (N a))
(GridLineFunction (N a))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MinorGridLines (V a) (N a) -> GridLineFunction (N a)
forall (v :: * -> *) n. MinorGridLines v n -> GridLineFunction n
migFun (\MinorGridLines (V a) (N a)
gl GridLineFunction (N a)
mif -> MinorGridLines (V a) (N a)
gl {migFun :: GridLineFunction (N a)
migFun = GridLineFunction (N a)
mif})
minorGridLinesStyle :: Functor f => LensLike' f a (Style (V a) (N a))
minorGridLinesStyle = LensLike' f a (MinorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines LensLike' f a (MinorGridLines (V a) (N a))
-> ((Style (V a) (N a) -> f (Style (V a) (N a)))
-> MinorGridLines (V a) (N a) -> f (MinorGridLines (V a) (N a)))
-> LensLike' f a (Style (V a) (N a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MinorGridLines (V a) (N a) -> Style (V a) (N a))
-> (MinorGridLines (V a) (N a)
-> Style (V a) (N a) -> MinorGridLines (V a) (N a))
-> Lens
(MinorGridLines (V a) (N a))
(MinorGridLines (V a) (N a))
(Style (V a) (N a))
(Style (V a) (N a))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MinorGridLines (V a) (N a) -> Style (V a) (N a)
forall (v :: * -> *) n. MinorGridLines v n -> Style v n
migStyle (\MinorGridLines (V a) (N a)
gl Style (V a) (N a)
sty -> MinorGridLines (V a) (N a)
gl {migStyle :: Style (V a) (N a)
migStyle = Style (V a) (N a)
sty})
instance HasMinorGridLines f (MinorGridLines v n) where
minorGridLines :: LensLike'
f
(MinorGridLines v n)
(MinorGridLines (V (MinorGridLines v n)) (N (MinorGridLines v n)))
minorGridLines = LensLike'
f
(MinorGridLines v n)
(MinorGridLines (V (MinorGridLines v n)) (N (MinorGridLines v n)))
forall a. a -> a
id
instance (Typeable n, Floating n) => Default (MinorGridLines v n) where
def :: MinorGridLines v n
def = MinorGridLines
{ migFun :: GridLineFunction n
migFun = GridLineFunction n
forall n. GridLineFunction n
onTicksGridLineFunction
, migStyle :: Style v n
migStyle = Style v n
forall a. Monoid a => a
mempty Style v n -> (Style v n -> Style v n) -> Style v n
forall a b. a -> (a -> b) -> b
# n -> Style v n -> Style v n
forall a n. (N a ~ n, HasStyle a, Typeable n) => n -> a -> a
lwO n
0.5
, migVisible :: Bool
migVisible = Bool
False
}
instance HasVisibility (MinorGridLines v n) where
visible :: Lens' (MinorGridLines v n) Bool
visible = (MinorGridLines v n -> Bool)
-> (MinorGridLines v n -> Bool -> MinorGridLines v n)
-> Lens' (MinorGridLines v n) Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MinorGridLines v n -> Bool
forall (v :: * -> *) n. MinorGridLines v n -> Bool
migVisible (\MinorGridLines v n
gl Bool
b -> MinorGridLines v n
gl {migVisible :: Bool
migVisible = Bool
b})
instance Typeable n => HasStyle (MinorGridLines v n) where
applyStyle :: Style (V (MinorGridLines v n)) (N (MinorGridLines v n))
-> MinorGridLines v n -> MinorGridLines v n
applyStyle Style (V (MinorGridLines v n)) (N (MinorGridLines v n))
s = (Style v n -> Identity (Style v n))
-> MinorGridLines v n -> Identity (MinorGridLines v n)
forall (f :: * -> *) a.
(HasMinorGridLines f a, Functor f) =>
LensLike' f a (Style (V a) (N a))
minorGridLinesStyle ((Style v n -> Identity (Style v n))
-> MinorGridLines v n -> Identity (MinorGridLines v n))
-> (Style v n -> Style v n)
-> MinorGridLines v n
-> MinorGridLines v n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Style (V (Style v n)) (N (Style v n)) -> Style v n -> Style v n
forall a. HasStyle a => Style (V a) (N a) -> a -> a
applyStyle Style (V (Style v n)) (N (Style v n))
Style (V (MinorGridLines v n)) (N (MinorGridLines v n))
s
onTicksGridLineFunction :: GridLineFunction n
onTicksGridLineFunction :: forall n. GridLineFunction n
onTicksGridLineFunction = [n] -> (n, n) -> [n]
forall a b. a -> b -> a
const
emptyGridLineFunction :: GridLineFunction n
emptyGridLineFunction :: forall n. GridLineFunction n
emptyGridLineFunction [n]
_ (n, n)
_ = []
gridLinesVisible :: (HasGridLines f a, Applicative f) => LensLike' f a Bool
gridLinesVisible :: forall (f :: * -> *) a.
(HasGridLines f a, Applicative f) =>
LensLike' f a Bool
gridLinesVisible = LensLike' f a (GridLines (V a) (N a))
forall (f :: * -> *) a.
HasGridLines f a =>
LensLike' f a (GridLines (V a) (N a))
gridLines LensLike' f a (GridLines (V a) (N a))
-> ((Bool -> f Bool)
-> GridLines (V a) (N a) -> f (GridLines (V a) (N a)))
-> (Bool -> f Bool)
-> a
-> f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> f Bool)
-> GridLines (V a) (N a) -> f (GridLines (V a) (N a))
forall (v :: * -> *) n. Traversal' (GridLines v n) Bool
vis where
vis :: Traversal' (GridLines v n) Bool
vis :: forall (v :: * -> *) n. Traversal' (GridLines v n) Bool
vis Bool -> f Bool
f GridLines v n
a =
(\Bool
m Bool
mn -> GridLines v n
a GridLines v n -> (GridLines v n -> GridLines v n) -> GridLines v n
forall a b. a -> (a -> b) -> b
& (MajorGridLines v n -> Identity (MajorGridLines v n))
-> GridLines v n -> Identity (GridLines v n)
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines ((MajorGridLines v n -> Identity (MajorGridLines v n))
-> GridLines v n -> Identity (GridLines v n))
-> ((Bool -> Identity Bool)
-> MajorGridLines v n -> Identity (MajorGridLines v n))
-> (Bool -> Identity Bool)
-> GridLines v n
-> Identity (GridLines v n)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Identity Bool)
-> MajorGridLines v n -> Identity (MajorGridLines v n)
forall a. HasVisibility a => Lens' a Bool
visible ((Bool -> Identity Bool)
-> GridLines v n -> Identity (GridLines v n))
-> Bool -> GridLines v n -> GridLines v n
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Bool
m GridLines v n -> (GridLines v n -> GridLines v n) -> GridLines v n
forall a b. a -> (a -> b) -> b
& (MinorGridLines v n -> Identity (MinorGridLines v n))
-> GridLines v n -> Identity (GridLines v n)
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines ((MinorGridLines v n -> Identity (MinorGridLines v n))
-> GridLines v n -> Identity (GridLines v n))
-> ((Bool -> Identity Bool)
-> MinorGridLines v n -> Identity (MinorGridLines v n))
-> (Bool -> Identity Bool)
-> GridLines v n
-> Identity (GridLines v n)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Identity Bool)
-> MinorGridLines v n -> Identity (MinorGridLines v n)
forall a. HasVisibility a => Lens' a Bool
visible ((Bool -> Identity Bool)
-> GridLines v n -> Identity (GridLines v n))
-> Bool -> GridLines v n -> GridLines v n
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Bool
mn)
(Bool -> Bool -> GridLines v n)
-> f Bool -> f (Bool -> GridLines v n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Bool -> f Bool
f (GridLines v n
a GridLines v n -> Getting Bool (GridLines v n) Bool -> Bool
forall s a. s -> Getting a s a -> a
^. (MajorGridLines v n -> Const Bool (MajorGridLines v n))
-> GridLines v n -> Const Bool (GridLines v n)
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines ((MajorGridLines v n -> Const Bool (MajorGridLines v n))
-> GridLines v n -> Const Bool (GridLines v n))
-> ((Bool -> Const Bool Bool)
-> MajorGridLines v n -> Const Bool (MajorGridLines v n))
-> Getting Bool (GridLines v n) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Const Bool Bool)
-> MajorGridLines v n -> Const Bool (MajorGridLines v n)
forall a. HasVisibility a => Lens' a Bool
visible) f (Bool -> GridLines v n) -> f Bool -> f (GridLines v n)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> f Bool
f (GridLines v n
a GridLines v n -> Getting Bool (GridLines v n) Bool -> Bool
forall s a. s -> Getting a s a -> a
^. (MinorGridLines v n -> Const Bool (MinorGridLines v n))
-> GridLines v n -> Const Bool (GridLines v n)
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines ((MinorGridLines v n -> Const Bool (MinorGridLines v n))
-> GridLines v n -> Const Bool (GridLines v n))
-> ((Bool -> Const Bool Bool)
-> MinorGridLines v n -> Const Bool (MinorGridLines v n))
-> Getting Bool (GridLines v n) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Const Bool Bool)
-> MinorGridLines v n -> Const Bool (MinorGridLines v n)
forall a. HasVisibility a => Lens' a Bool
visible)
data GridLines v n = GridLines
{ forall (v :: * -> *) n. GridLines v n -> MajorGridLines v n
majGrid :: MajorGridLines v n
, forall (v :: * -> *) n. GridLines v n -> MinorGridLines v n
minGrid :: MinorGridLines v n
} deriving Typeable
type instance V (GridLines v n) = v
type instance N (GridLines v n) = n
class (HasMinorGridLines f a, HasMajorGridLines f a) => HasGridLines f a where
gridLines :: LensLike' f a (GridLines (V a) (N a))
instance Functor f => HasGridLines f (GridLines v n) where
gridLines :: LensLike'
f
(GridLines v n)
(GridLines (V (GridLines v n)) (N (GridLines v n)))
gridLines = LensLike'
f
(GridLines v n)
(GridLines (V (GridLines v n)) (N (GridLines v n)))
forall a. a -> a
id
instance (Typeable n, Floating n) => Default (GridLines v n) where
def :: GridLines v n
def = GridLines
{ majGrid :: MajorGridLines v n
majGrid = MajorGridLines v n
forall a. Default a => a
def
, minGrid :: MinorGridLines v n
minGrid = MinorGridLines v n
forall a. Default a => a
def
}
instance Functor f => HasMajorGridLines f (GridLines v n) where
majorGridLines :: LensLike'
f
(GridLines v n)
(MajorGridLines (V (GridLines v n)) (N (GridLines v n)))
majorGridLines = (GridLines v n -> MajorGridLines v n)
-> (GridLines v n -> MajorGridLines v n -> GridLines v n)
-> Lens
(GridLines v n)
(GridLines v n)
(MajorGridLines v n)
(MajorGridLines v n)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens GridLines v n -> MajorGridLines v n
forall (v :: * -> *) n. GridLines v n -> MajorGridLines v n
majGrid (\GridLines v n
g MajorGridLines v n
a -> GridLines v n
g {majGrid :: MajorGridLines v n
majGrid = MajorGridLines v n
a})
instance Functor f => HasMinorGridLines f (GridLines v n) where
minorGridLines :: LensLike'
f
(GridLines v n)
(MinorGridLines (V (GridLines v n)) (N (GridLines v n)))
minorGridLines = (GridLines v n -> MinorGridLines v n)
-> (GridLines v n -> MinorGridLines v n -> GridLines v n)
-> Lens
(GridLines v n)
(GridLines v n)
(MinorGridLines v n)
(MinorGridLines v n)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens GridLines v n -> MinorGridLines v n
forall (v :: * -> *) n. GridLines v n -> MinorGridLines v n
minGrid (\GridLines v n
g MinorGridLines v n
a -> GridLines v n
g {minGrid :: MinorGridLines v n
minGrid = MinorGridLines v n
a})
instance Typeable n => HasStyle (GridLines v n) where
applyStyle :: Style (V (GridLines v n)) (N (GridLines v n))
-> GridLines v n -> GridLines v n
applyStyle Style (V (GridLines v n)) (N (GridLines v n))
s = ((MajorGridLines v n -> Identity (MajorGridLines v n))
-> GridLines v n -> Identity (GridLines v n)
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines ((MajorGridLines v n -> Identity (MajorGridLines v n))
-> GridLines v n -> Identity (GridLines v n))
-> (MajorGridLines v n -> MajorGridLines v n)
-> GridLines v n
-> GridLines v n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Style (V (MajorGridLines v n)) (N (MajorGridLines v n))
-> MajorGridLines v n -> MajorGridLines v n
forall a. HasStyle a => Style (V a) (N a) -> a -> a
applyStyle Style (V (GridLines v n)) (N (GridLines v n))
Style (V (MajorGridLines v n)) (N (MajorGridLines v n))
s) (GridLines v n -> GridLines v n)
-> (GridLines v n -> GridLines v n)
-> GridLines v n
-> GridLines v n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((MinorGridLines v n -> Identity (MinorGridLines v n))
-> GridLines v n -> Identity (GridLines v n)
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines ((MinorGridLines v n -> Identity (MinorGridLines v n))
-> GridLines v n -> Identity (GridLines v n))
-> (MinorGridLines v n -> MinorGridLines v n)
-> GridLines v n
-> GridLines v n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Style (V (MinorGridLines v n)) (N (MinorGridLines v n))
-> MinorGridLines v n -> MinorGridLines v n
forall a. HasStyle a => Style (V a) (N a) -> a -> a
applyStyle Style (V (GridLines v n)) (N (GridLines v n))
Style (V (MinorGridLines v n)) (N (MinorGridLines v n))
s)
hideGridLines :: (HasGridLines Identity a, MonadState a m) => m ()
hideGridLines :: forall a (m :: * -> *).
(HasGridLines Identity a, MonadState a m) =>
m ()
hideGridLines = do
LensLike' Identity a (MinorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines LensLike' Identity a (MinorGridLines (V a) (N a))
-> ((Bool -> Identity Bool)
-> MinorGridLines (V a) (N a)
-> Identity (MinorGridLines (V a) (N a)))
-> (Bool -> Identity Bool)
-> a
-> Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Identity Bool)
-> MinorGridLines (V a) (N a)
-> Identity (MinorGridLines (V a) (N a))
forall a. HasVisibility a => Lens' a Bool
visible ((Bool -> Identity Bool) -> a -> Identity a) -> Bool -> m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Bool
False
LensLike' Identity a (MajorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines LensLike' Identity a (MajorGridLines (V a) (N a))
-> ((Bool -> Identity Bool)
-> MajorGridLines (V a) (N a)
-> Identity (MajorGridLines (V a) (N a)))
-> (Bool -> Identity Bool)
-> a
-> Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Identity Bool)
-> MajorGridLines (V a) (N a)
-> Identity (MajorGridLines (V a) (N a))
forall a. HasVisibility a => Lens' a Bool
visible ((Bool -> Identity Bool) -> a -> Identity a) -> Bool -> m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Bool
False
showGridLines :: (HasGridLines Identity a, MonadState a m) => m ()
showGridLines :: forall a (m :: * -> *).
(HasGridLines Identity a, MonadState a m) =>
m ()
showGridLines = do
LensLike' Identity a (MinorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMinorGridLines f a =>
LensLike' f a (MinorGridLines (V a) (N a))
minorGridLines LensLike' Identity a (MinorGridLines (V a) (N a))
-> ((Bool -> Identity Bool)
-> MinorGridLines (V a) (N a)
-> Identity (MinorGridLines (V a) (N a)))
-> (Bool -> Identity Bool)
-> a
-> Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Identity Bool)
-> MinorGridLines (V a) (N a)
-> Identity (MinorGridLines (V a) (N a))
forall a. HasVisibility a => Lens' a Bool
visible ((Bool -> Identity Bool) -> a -> Identity a) -> Bool -> m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Bool
True
LensLike' Identity a (MajorGridLines (V a) (N a))
forall (f :: * -> *) a.
HasMajorGridLines f a =>
LensLike' f a (MajorGridLines (V a) (N a))
majorGridLines LensLike' Identity a (MajorGridLines (V a) (N a))
-> ((Bool -> Identity Bool)
-> MajorGridLines (V a) (N a)
-> Identity (MajorGridLines (V a) (N a)))
-> (Bool -> Identity Bool)
-> a
-> Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> Identity Bool)
-> MajorGridLines (V a) (N a)
-> Identity (MajorGridLines (V a) (N a))
forall a. HasVisibility a => Lens' a Bool
visible ((Bool -> Identity Bool) -> a -> Identity a) -> Bool -> m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Bool
True
gridLinesStyle :: (HasGridLines f a, Applicative f) => LensLike' f a (Style (V a) (N a))
gridLinesStyle :: forall (f :: * -> *) a.
(HasGridLines f a, Applicative f) =>
LensLike' f a (Style (V a) (N a))
gridLinesStyle = LensLike' f a (GridLines (V a) (N a))
forall (f :: * -> *) a.
HasGridLines f a =>
LensLike' f a (GridLines (V a) (N a))
gridLines LensLike' f a (GridLines (V a) (N a))
-> ((Style (V a) (N a) -> f (Style (V a) (N a)))
-> GridLines (V a) (N a) -> f (GridLines (V a) (N a)))
-> (Style (V a) (N a) -> f (Style (V a) (N a)))
-> a
-> f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Style (V a) (N a) -> f (Style (V a) (N a)))
-> GridLines (V a) (N a) -> f (GridLines (V a) (N a))
forall (v :: * -> *) n. Traversal' (GridLines v n) (Style v n)
styles where
styles :: Traversal' (GridLines v n) (Style v n)
styles :: forall (v :: * -> *) n. Traversal' (GridLines v n) (Style v n)
styles Style v n -> f (Style v n)
f GridLines v n
a =
(\Style v n
m Style v n
mn -> GridLines v n
a GridLines v n -> (GridLines v n -> GridLines v n) -> GridLines v n
forall a b. a -> (a -> b) -> b
& (Style v n -> Identity (Style v n))
-> GridLines v n -> Identity (GridLines v n)
forall (f :: * -> *) a.
(HasMajorGridLines f a, Functor f) =>
LensLike' f a (Style (V a) (N a))
majorGridLinesStyle ((Style v n -> Identity (Style v n))
-> GridLines v n -> Identity (GridLines v n))
-> Style v n -> GridLines v n -> GridLines v n
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Style v n
m GridLines v n -> (GridLines v n -> GridLines v n) -> GridLines v n
forall a b. a -> (a -> b) -> b
& (Style v n -> Identity (Style v n))
-> GridLines v n -> Identity (GridLines v n)
forall (f :: * -> *) a.
(HasMinorGridLines f a, Functor f) =>
LensLike' f a (Style (V a) (N a))
minorGridLinesStyle ((Style v n -> Identity (Style v n))
-> GridLines v n -> Identity (GridLines v n))
-> Style v n -> GridLines v n -> GridLines v n
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Style v n
mn)
(Style v n -> Style v n -> GridLines v n)
-> f (Style v n) -> f (Style v n -> GridLines v n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Style v n -> f (Style v n)
f (GridLines v n
a GridLines v n
-> Getting (Style v n) (GridLines v n) (Style v n) -> Style v n
forall s a. s -> Getting a s a -> a
^. Getting (Style v n) (GridLines v n) (Style v n)
forall (f :: * -> *) a.
(HasMajorGridLines f a, Functor f) =>
LensLike' f a (Style (V a) (N a))
majorGridLinesStyle) f (Style v n -> GridLines v n)
-> f (Style v n) -> f (GridLines v n)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Style v n -> f (Style v n)
f (GridLines v n
a GridLines v n
-> Getting (Style v n) (GridLines v n) (Style v n) -> Style v n
forall s a. s -> Getting a s a -> a
^. Getting (Style v n) (GridLines v n) (Style v n)
forall (f :: * -> *) a.
(HasMinorGridLines f a, Functor f) =>
LensLike' f a (Style (V a) (N a))
minorGridLinesStyle)