From f4c419b9ddec15bad267a4463f0720d6e28042d2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 30 May 2019 12:18:08 +0200 Subject: Further work --- interactive-edit-lens/src/Interact/Types.hs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'interactive-edit-lens/src/Interact') diff --git a/interactive-edit-lens/src/Interact/Types.hs b/interactive-edit-lens/src/Interact/Types.hs index a4d08ac..67f9ae3 100644 --- a/interactive-edit-lens/src/Interact/Types.hs +++ b/interactive-edit-lens/src/Interact/Types.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TemplateHaskell, DeriveGeneric, StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Interact.Types @@ -6,7 +6,7 @@ module Interact.Types , _LeftEditor, _RightEditor, _PrimitiveName , Validity, pattern Valid, pattern Invalid , InteractState(..) - , HasLeft(..), HasRight(..), HasComplement(..), HasFocus(..), HasFocused(..) + , HasLeft(..), HasRight(..), HasComplement(..), HasFocus(..), HasFocused(..), HasActive(..), HasLoadBrowser(..) , InteractInitial(..) , _InitialLeft, _InitialRight, _InitialEmpty , InteractConfig(..) @@ -38,6 +38,7 @@ import Numeric.Natural import Brick import Brick.Focus import Brick.Widgets.Edit +import Brick.Widgets.FileBrowser import Control.Lens import Control.Lens.TH @@ -47,12 +48,29 @@ import Control.DFST.Lens import Data.Text.Zipper.Generic +import Control.DeepSeq +import GHC.Generics (Generic) + + +deriving instance Generic (StringEdit n c) +instance (NFData n, NFData c) => NFData (StringEdit n c) + +deriving instance Generic (StringEdits n c) +instance (NFData n, NFData c) => NFData (StringEdits n c) + +deriving instance Generic (DFSTAction s c c') +instance (NFData s, NFData c, NFData c') => NFData (DFSTAction s c c') + +instance (NFData s, NFData c, NFData c') => NFData (DFSTComplement s c c') where + rnf = foldr deepseq () + data InteractName = LeftEditor | RightEditor + | LoadBrowser | PrimitiveName !Text - deriving (Eq, Ord, Show, Read) + deriving (Eq, Ord, Show, Read, Generic) makePrisms ''InteractName @@ -64,6 +82,8 @@ data InteractState c = InteractState { istLeft, istRight :: (Last Validity, Last (Seq Char, Int), StringEdits Natural Char) , istComplement :: c , istFocus :: FocusRing InteractName + , istActive :: Bool + , istLoadBrowser :: Maybe (FileBrowser InteractName) } makeLensesWith abbreviatedFields ''InteractState -- cgit v1.2.3