diff options
| author | tv <tv@shackspace.de> | 2014-07-27 20:51:13 +0200 | 
|---|---|---|
| committer | tv <tv@shackspace.de> | 2014-07-27 20:51:13 +0200 | 
| commit | 6160fbfd34179b660586f88d4dec5dfe14173fbf (patch) | |
| tree | 50d7d995e8af5e6eebbbf844b9a7df5b8643118f | |
| parent | 75ebdc58d851ae101ca8d801ea8eae72d74bdf0d (diff) | |
instance Monoid Command
| -rw-r--r-- | Main.hs | 24 | 
1 files changed, 24 insertions, 0 deletions
| @@ -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 () | 
