summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-05-14 21:02:21 +0200
committertv <tv@krebsco.de>2019-05-14 21:02:21 +0200
commitfa3e4365193857ecf78138d6e7aee55f38a61baa (patch)
tree8b85494bc27f5150d0d132eec645a1df603e0b83
parent8fc4fbb5bb7781626da8f63cd8df8bb0f554cfe7 (diff)
test5: move State to separate module
-rw-r--r--State.hs20
-rw-r--r--test5.hs14
2 files changed, 21 insertions, 13 deletions
diff --git a/State.hs b/State.hs
new file mode 100644
index 0000000..1f2b3d3
--- /dev/null
+++ b/State.hs
@@ -0,0 +1,20 @@
+module State where
+
+import Blessings.String (Blessings)
+import Data.Time
+import qualified Data.Tree.Zipper as Z
+import System.Posix.Signals
+import TreeView (TreeView)
+
+data State = State
+ { cursor :: Z.TreePos Z.Full TreeView
+ , xoffset :: Int
+ , yoffset :: Int
+ , flashMessage :: Blessings String
+ , screenWidth :: Int
+ , screenHeight :: Int
+ , headBuffer :: [Blessings String]
+ , treeBuffer :: [Blessings String]
+ , now :: UTCTime
+ , signalHandlers :: [(Signal, IO ())]
+ }
diff --git a/test5.hs b/test5.hs
index aa61776..fc46495 100644
--- a/test5.hs
+++ b/test5.hs
@@ -35,6 +35,7 @@ import RenderTreeView (renderTreeView)
import Scanner (scan,Scan(..))
import Screen
import Safe
+import State
import System.Directory
import System.Console.Docopt.NoTH (getArgWithDefault, parseArgsOrExit, parseUsageOrExit, shortOption)
import System.Environment
@@ -68,19 +69,6 @@ withForkWait async body = do
restore (body wait) `onException` killThread tid
-data State = State
- { cursor :: Z.TreePos Z.Full TreeView
- , xoffset :: Int
- , yoffset :: Int
- , flashMessage :: Blessings String
- , screenWidth :: Int
- , screenHeight :: Int
- , headBuffer :: [Blessings String]
- , treeBuffer :: [Blessings String]
- , now :: UTCTime
- , signalHandlers :: [(Signal, IO ())]
- }
-
initState :: String -> IO State
initState query = do
r_ <- either error id <$> Notmuch.search