{-# LANGUAGE TemplateHaskell #-}
module Vgrep.Environment
( Environment (..)
, Viewport (..)
, config
, viewport
, vpHeight
, vpWidth
, viewportWidth
, viewportHeight
, module Vgrep.Environment.Config
) where
import Control.Lens.Compat
import Vgrep.Environment.Config
data Viewport = Viewport { Viewport -> Int
_vpWidth :: Int, Viewport -> Int
_vpHeight :: Int }
deriving (Viewport -> Viewport -> Bool
(Viewport -> Viewport -> Bool)
-> (Viewport -> Viewport -> Bool) -> Eq Viewport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Viewport -> Viewport -> Bool
$c/= :: Viewport -> Viewport -> Bool
== :: Viewport -> Viewport -> Bool
$c== :: Viewport -> Viewport -> Bool
Eq, Int -> Viewport -> ShowS
[Viewport] -> ShowS
Viewport -> String
(Int -> Viewport -> ShowS)
-> (Viewport -> String) -> ([Viewport] -> ShowS) -> Show Viewport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Viewport] -> ShowS
$cshowList :: [Viewport] -> ShowS
show :: Viewport -> String
$cshow :: Viewport -> String
showsPrec :: Int -> Viewport -> ShowS
$cshowsPrec :: Int -> Viewport -> ShowS
Show)
makeLenses ''Viewport
data Environment = Env
{ Environment -> Config
_config :: Config
, Environment -> Viewport
_viewport :: Viewport
} deriving (Environment -> Environment -> Bool
(Environment -> Environment -> Bool)
-> (Environment -> Environment -> Bool) -> Eq Environment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Environment -> Environment -> Bool
$c/= :: Environment -> Environment -> Bool
== :: Environment -> Environment -> Bool
$c== :: Environment -> Environment -> Bool
Eq, Int -> Environment -> ShowS
[Environment] -> ShowS
Environment -> String
(Int -> Environment -> ShowS)
-> (Environment -> String)
-> ([Environment] -> ShowS)
-> Show Environment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Environment] -> ShowS
$cshowList :: [Environment] -> ShowS
show :: Environment -> String
$cshow :: Environment -> String
showsPrec :: Int -> Environment -> ShowS
$cshowsPrec :: Int -> Environment -> ShowS
Show)
makeLenses ''Environment
viewportHeight, viewportWidth :: Lens' Environment Int
viewportHeight :: (Int -> f Int) -> Environment -> f Environment
viewportHeight = (Viewport -> f Viewport) -> Environment -> f Environment
Lens' Environment Viewport
viewport ((Viewport -> f Viewport) -> Environment -> f Environment)
-> ((Int -> f Int) -> Viewport -> f Viewport)
-> (Int -> f Int)
-> Environment
-> f Environment
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> f Int) -> Viewport -> f Viewport
Lens' Viewport Int
vpHeight
viewportWidth :: (Int -> f Int) -> Environment -> f Environment
viewportWidth = (Viewport -> f Viewport) -> Environment -> f Environment
Lens' Environment Viewport
viewport ((Viewport -> f Viewport) -> Environment -> f Environment)
-> ((Int -> f Int) -> Viewport -> f Viewport)
-> (Int -> f Int)
-> Environment
-> f Environment
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> f Int) -> Viewport -> f Viewport
Lens' Viewport Int
vpWidth