summaryrefslogtreecommitdiff
path: root/interactive-edit-lens/src/Interact
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2019-05-30 12:18:08 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2019-05-30 12:18:08 +0200
commitf4c419b9ddec15bad267a4463f0720d6e28042d2 (patch)
tree54a0259116476150247619c4410eae33f8669314 /interactive-edit-lens/src/Interact
parent8afbe1f7df24034dd16fdf2e89b0665b2318ae2a (diff)
downloadincremental-dfsts-f4c419b9ddec15bad267a4463f0720d6e28042d2.tar
incremental-dfsts-f4c419b9ddec15bad267a4463f0720d6e28042d2.tar.gz
incremental-dfsts-f4c419b9ddec15bad267a4463f0720d6e28042d2.tar.bz2
incremental-dfsts-f4c419b9ddec15bad267a4463f0720d6e28042d2.tar.xz
incremental-dfsts-f4c419b9ddec15bad267a4463f0720d6e28042d2.zip
Further work
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