summaryrefslogtreecommitdiff
path: root/interactive-edit-lens/src/Interact
diff options
context:
space:
mode:
Diffstat (limited to 'interactive-edit-lens/src/Interact')
-rw-r--r--interactive-edit-lens/src/Interact/Types.hs26
1 files changed, 23 insertions, 3 deletions
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 @@
1{-# LANGUAGE TemplateHaskell #-} 1{-# LANGUAGE TemplateHaskell, DeriveGeneric, StandaloneDeriving #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-} 2{-# OPTIONS_GHC -fno-warn-orphans #-}
3 3
4module Interact.Types 4module Interact.Types
@@ -6,7 +6,7 @@ module Interact.Types
6 , _LeftEditor, _RightEditor, _PrimitiveName 6 , _LeftEditor, _RightEditor, _PrimitiveName
7 , Validity, pattern Valid, pattern Invalid 7 , Validity, pattern Valid, pattern Invalid
8 , InteractState(..) 8 , InteractState(..)
9 , HasLeft(..), HasRight(..), HasComplement(..), HasFocus(..), HasFocused(..) 9 , HasLeft(..), HasRight(..), HasComplement(..), HasFocus(..), HasFocused(..), HasActive(..), HasLoadBrowser(..)
10 , InteractInitial(..) 10 , InteractInitial(..)
11 , _InitialLeft, _InitialRight, _InitialEmpty 11 , _InitialLeft, _InitialRight, _InitialEmpty
12 , InteractConfig(..) 12 , InteractConfig(..)
@@ -38,6 +38,7 @@ import Numeric.Natural
38import Brick 38import Brick
39import Brick.Focus 39import Brick.Focus
40import Brick.Widgets.Edit 40import Brick.Widgets.Edit
41import Brick.Widgets.FileBrowser
41 42
42import Control.Lens 43import Control.Lens
43import Control.Lens.TH 44import Control.Lens.TH
@@ -47,12 +48,29 @@ import Control.DFST.Lens
47 48
48import Data.Text.Zipper.Generic 49import Data.Text.Zipper.Generic
49 50
51import Control.DeepSeq
52import GHC.Generics (Generic)
53
54
55deriving instance Generic (StringEdit n c)
56instance (NFData n, NFData c) => NFData (StringEdit n c)
57
58deriving instance Generic (StringEdits n c)
59instance (NFData n, NFData c) => NFData (StringEdits n c)
60
61deriving instance Generic (DFSTAction s c c')
62instance (NFData s, NFData c, NFData c') => NFData (DFSTAction s c c')
63
64instance (NFData s, NFData c, NFData c') => NFData (DFSTComplement s c c') where
65 rnf = foldr deepseq ()
66
50 67
51data InteractName 68data InteractName
52 = LeftEditor 69 = LeftEditor
53 | RightEditor 70 | RightEditor
71 | LoadBrowser
54 | PrimitiveName !Text 72 | PrimitiveName !Text
55 deriving (Eq, Ord, Show, Read) 73 deriving (Eq, Ord, Show, Read, Generic)
56 74
57makePrisms ''InteractName 75makePrisms ''InteractName
58 76
@@ -64,6 +82,8 @@ data InteractState c = InteractState
64 { istLeft, istRight :: (Last Validity, Last (Seq Char, Int), StringEdits Natural Char) 82 { istLeft, istRight :: (Last Validity, Last (Seq Char, Int), StringEdits Natural Char)
65 , istComplement :: c 83 , istComplement :: c
66 , istFocus :: FocusRing InteractName 84 , istFocus :: FocusRing InteractName
85 , istActive :: Bool
86 , istLoadBrowser :: Maybe (FileBrowser InteractName)
67 } 87 }
68 88
69makeLensesWith abbreviatedFields ''InteractState 89makeLensesWith abbreviatedFields ''InteractState