{-# OPTIONS_GHC -Wno-orphans #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
module GHCup.Types.Optics where
import GHCup.Types
import Control.Monad.Reader
import Data.ByteString ( ByteString )
import Optics
import URI.ByteString
makePrisms ''Tool
makePrisms ''Architecture
makePrisms ''LinuxDistro
makePrisms ''Platform
makePrisms ''Tag
makeLenses ''PlatformResult
makeLenses ''DownloadInfo
makeLenses ''Tag
makeLenses ''VersionInfo
makeLenses ''GHCTargetVersion
makeLenses ''GHCupInfo
uriSchemeL' :: Lens' (URIRef Absolute) Scheme
uriSchemeL' :: Lens' URI Scheme
uriSchemeL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL Lens' URI Scheme
uriSchemeL
schemeBSL' :: Lens' Scheme ByteString
schemeBSL' :: Lens' Scheme ByteString
schemeBSL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL Lens' Scheme ByteString
schemeBSL
authorityL' :: Lens' (URIRef a) (Maybe Authority)
authorityL' :: forall a. Lens' (URIRef a) (Maybe Authority)
authorityL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL forall a. Lens' (URIRef a) (Maybe Authority)
authorityL
authorityHostL' :: Lens' Authority Host
authorityHostL' :: Lens' Authority Host
authorityHostL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL Lens' Authority Host
authorityHostL
authorityPortL' :: Lens' Authority (Maybe Port)
authorityPortL' :: Lens' Authority (Maybe Port)
authorityPortL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL Lens' Authority (Maybe Port)
authorityPortL
portNumberL' :: Lens' Port Int
portNumberL' :: Lens' Port Int
portNumberL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL Lens' Port Int
portNumberL
hostBSL' :: Lens' Host ByteString
hostBSL' :: Lens' Host ByteString
hostBSL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL Lens' Host ByteString
hostBSL
pathL' :: Lens' (URIRef a) ByteString
pathL' :: forall a. Lens' (URIRef a) ByteString
pathL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL forall a. Lens' (URIRef a) ByteString
pathL
queryL' :: Lens' (URIRef a) Query
queryL' :: forall a. Lens' (URIRef a) Query
queryL' = forall s t a b. LensVL s t a b -> Lens s t a b
lensVL forall a. Lens' (URIRef a) Query
queryL
gets :: forall f a env m . (MonadReader env m, LabelOptic' f A_Lens env a)
=> m a
gets :: forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall (name :: Symbol) k s t a b.
LabelOptic name k s t a b =>
Optic k NoIx s t a b
labelOptic @f)
getAppState :: MonadReader AppState m => m AppState
getAppState :: forall (m :: * -> *). MonadReader AppState m => m AppState
getAppState = forall r (m :: * -> *). MonadReader r m => m r
ask
getLeanAppState :: ( MonadReader env m
, LabelOptic' "settings" A_Lens env Settings
, LabelOptic' "dirs" A_Lens env Dirs
, LabelOptic' "keyBindings" A_Lens env KeyBindings
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
)
=> m LeanAppState
getLeanAppState :: forall env (m :: * -> *).
(MonadReader env m, LabelOptic' "settings" A_Lens env Settings,
LabelOptic' "dirs" A_Lens env Dirs,
LabelOptic' "keyBindings" A_Lens env KeyBindings,
LabelOptic' "loggerConfig" A_Lens env LoggerConfig) =>
m LeanAppState
getLeanAppState = do
Settings
s <- forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"settings"
Dirs
d <- forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"dirs"
KeyBindings
k <- forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"keyBindings"
LoggerConfig
l <- forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"loggerConfig"
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Settings -> Dirs -> KeyBindings -> LoggerConfig -> LeanAppState
LeanAppState Settings
s Dirs
d KeyBindings
k LoggerConfig
l)
getSettings :: ( MonadReader env m
, LabelOptic' "settings" A_Lens env Settings
)
=> m Settings
getSettings :: forall env (m :: * -> *).
(MonadReader env m, LabelOptic' "settings" A_Lens env Settings) =>
m Settings
getSettings = forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"settings"
getDirs :: ( MonadReader env m
, LabelOptic' "dirs" A_Lens env Dirs
)
=> m Dirs
getDirs :: forall env (m :: * -> *).
(MonadReader env m, LabelOptic' "dirs" A_Lens env Dirs) =>
m Dirs
getDirs = forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"dirs"
getLogCleanup :: ( MonadReader env m
, LabelOptic' "logCleanup" A_Lens env (IO ())
)
=> m (IO ())
getLogCleanup :: forall env (m :: * -> *).
(MonadReader env m, LabelOptic' "logCleanup" A_Lens env (IO ())) =>
m (IO ())
getLogCleanup = forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"logCleanup"
getKeyBindings :: ( MonadReader env m
, LabelOptic' "keyBindings" A_Lens env KeyBindings
)
=> m KeyBindings
getKeyBindings :: forall env (m :: * -> *).
(MonadReader env m,
LabelOptic' "keyBindings" A_Lens env KeyBindings) =>
m KeyBindings
getKeyBindings = forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"keyBindings"
getGHCupInfo :: ( MonadReader env m
, LabelOptic' "ghcupInfo" A_Lens env GHCupInfo
)
=> m GHCupInfo
getGHCupInfo :: forall env (m :: * -> *).
(MonadReader env m,
LabelOptic' "ghcupInfo" A_Lens env GHCupInfo) =>
m GHCupInfo
getGHCupInfo = forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"ghcupInfo"
getPlatformReq :: ( MonadReader env m
, LabelOptic' "pfreq" A_Lens env PlatformRequest
)
=> m PlatformRequest
getPlatformReq :: forall env (m :: * -> *).
(MonadReader env m,
LabelOptic' "pfreq" A_Lens env PlatformRequest) =>
m PlatformRequest
getPlatformReq = forall (f :: Symbol) a env (m :: * -> *).
(MonadReader env m, LabelOptic' f A_Lens env a) =>
m a
gets @"pfreq"
type HasSettings env = (LabelOptic' "settings" A_Lens env Settings)
type HasDirs env = (LabelOptic' "dirs" A_Lens env Dirs)
type HasKeyBindings env = (LabelOptic' "keyBindings" A_Lens env KeyBindings)
type HasGHCupInfo env = (LabelOptic' "ghcupInfo" A_Lens env GHCupInfo)
type HasPlatformReq env = (LabelOptic' "pfreq" A_Lens env PlatformRequest)
type HasLog env = (LabelOptic' "loggerConfig" A_Lens env LoggerConfig)
getCache :: (MonadReader env m, HasSettings env) => m Bool
getCache :: forall env (m :: * -> *).
(MonadReader env m, HasSettings env) =>
m Bool
getCache = forall env (m :: * -> *).
(MonadReader env m, LabelOptic' "settings" A_Lens env Settings) =>
m Settings
getSettings forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> Settings -> Bool
cache
getDownloader :: (MonadReader env m, HasSettings env) => m Downloader
getDownloader :: forall env (m :: * -> *).
(MonadReader env m, HasSettings env) =>
m Downloader
getDownloader = forall env (m :: * -> *).
(MonadReader env m, LabelOptic' "settings" A_Lens env Settings) =>
m Settings
getSettings forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> Settings -> Downloader
downloader
instance LabelOptic "dirs" A_Lens Dirs Dirs Dirs Dirs where
labelOptic :: Optic A_Lens NoIx Dirs Dirs Dirs Dirs
labelOptic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. a -> a
id (\Dirs
_ Dirs
d -> Dirs
d)