ghcup-hs/lib-tui/GHCup/Brick/BrickState.hs

55 lines
1.9 KiB
Haskell
Raw Normal View History

2024-01-10 06:14:59 +00:00
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-unused-record-wildcards #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE InstanceSigs #-}
{-
2024-03-16 15:14:24 +00:00
This module contains the BrickState. One could be tempted to include this data structure in GHCup.Brick.Common,
2024-01-10 06:14:59 +00:00
but it is better to make a separated module in order to avoid cyclic dependencies.
2024-03-16 15:14:24 +00:00
This happens because the BrickState is sort of a container for all widgets,
2024-01-10 06:14:59 +00:00
but widgets depends on common functionality, hence:
2024-03-16 15:14:24 +00:00
BrickState `depends on` Widgets.XYZ `depends on` Common
2024-01-10 06:14:59 +00:00
2024-03-16 15:14:24 +00:00
The linear relation above breaks if BrickState is defined in Common.
2024-01-10 06:14:59 +00:00
-}
module GHCup.Brick.BrickState where
2024-02-28 16:01:54 +00:00
import GHCup.Types ( KeyBindings )
import GHCup.Brick.Common ( BrickData(..), BrickSettings(..), Mode(..))
import GHCup.Brick.Widgets.Navigation ( BrickInternalState)
import GHCup.Brick.Widgets.Menus.Context (ContextMenu)
import GHCup.Brick.Widgets.Menus.AdvanceInstall (AdvanceInstallMenu)
import GHCup.Brick.Widgets.Menus.CompileGHC (CompileGHCMenu)
import Optics.TH (makeLenses)
2024-03-04 16:32:22 +00:00
import GHCup.Brick.Widgets.Menus.CompileHLS (CompileHLSMenu)
2024-01-10 06:14:59 +00:00
data BrickState = BrickState
2024-02-28 09:29:39 +00:00
{ _appData :: BrickData
, _appSettings :: BrickSettings
, _appState :: BrickInternalState
, _contextMenu :: ContextMenu
, _advanceInstallMenu :: AdvanceInstallMenu
2024-02-28 16:01:54 +00:00
, _compileGHCMenu :: CompileGHCMenu
2024-03-04 16:32:22 +00:00
, _compileHLSMenu :: CompileHLSMenu
2024-02-28 09:29:39 +00:00
, _appKeys :: KeyBindings
, _mode :: Mode
2024-01-10 06:14:59 +00:00
}
--deriving Show
makeLenses ''BrickState