diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2019-05-30 12:18:08 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2019-05-30 12:18:08 +0200 |
| commit | f4c419b9ddec15bad267a4463f0720d6e28042d2 (patch) | |
| tree | 54a0259116476150247619c4410eae33f8669314 /interactive-edit-lens/src/Interact | |
| parent | 8afbe1f7df24034dd16fdf2e89b0665b2318ae2a (diff) | |
| download | incremental-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.hs | 26 |
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 | ||
| 4 | module Interact.Types | 4 | module 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 | |||
| 38 | import Brick | 38 | import Brick |
| 39 | import Brick.Focus | 39 | import Brick.Focus |
| 40 | import Brick.Widgets.Edit | 40 | import Brick.Widgets.Edit |
| 41 | import Brick.Widgets.FileBrowser | ||
| 41 | 42 | ||
| 42 | import Control.Lens | 43 | import Control.Lens |
| 43 | import Control.Lens.TH | 44 | import Control.Lens.TH |
| @@ -47,12 +48,29 @@ import Control.DFST.Lens | |||
| 47 | 48 | ||
| 48 | import Data.Text.Zipper.Generic | 49 | import Data.Text.Zipper.Generic |
| 49 | 50 | ||
| 51 | import Control.DeepSeq | ||
| 52 | import GHC.Generics (Generic) | ||
| 53 | |||
| 54 | |||
| 55 | deriving instance Generic (StringEdit n c) | ||
| 56 | instance (NFData n, NFData c) => NFData (StringEdit n c) | ||
| 57 | |||
| 58 | deriving instance Generic (StringEdits n c) | ||
| 59 | instance (NFData n, NFData c) => NFData (StringEdits n c) | ||
| 60 | |||
| 61 | deriving instance Generic (DFSTAction s c c') | ||
| 62 | instance (NFData s, NFData c, NFData c') => NFData (DFSTAction s c c') | ||
| 63 | |||
| 64 | instance (NFData s, NFData c, NFData c') => NFData (DFSTComplement s c c') where | ||
| 65 | rnf = foldr deepseq () | ||
| 66 | |||
| 50 | 67 | ||
| 51 | data InteractName | 68 | data 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 | ||
| 57 | makePrisms ''InteractName | 75 | makePrisms ''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 | ||
| 69 | makeLensesWith abbreviatedFields ''InteractState | 89 | makeLensesWith abbreviatedFields ''InteractState |
