summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
index 7e4bd0b..465610d 100644
--- a/Main.hs
+++ b/Main.hs
@@ -116,6 +116,13 @@ data Command
-- TODO Move Count Motion
-- Delete Count Register Motion
-- etc.
+ | Combine Command Command
+ | Nop
+
+instance Monoid Command where
+ mempty = Nop
+ mappend = Combine
+
data ExecError
@@ -232,8 +239,25 @@ execCommand (AlertBadInput s) =
execCommand (UnboundSequence s n) =
throwError (UnboundSequenceError s n)
+execCommand (Combine c1 c2) = do
+ q0 <- get
+
+ ((eSt1, lines1), q1) <- liftIO $ runExecCommand q0 (execCommand c1)
+
+ -- TODO "stack trace"
+ whenLeft eSt1 throwError
+
+ ((eSt2, lines2), q2) <- liftIO $ runExecCommand q1 (execCommand c2)
+
+ -- TODO "stack trace"
+ whenLeft eSt2 throwError
+
+ tell lines1
+ tell lines2
+ put q2
+execCommand Nop = return ()