load s m (input:r) =
  case parseStack input of
    Left e -> print e >> return m
    Right s -> do
      let x = runIdentity $ evalStack (s, m, ([],[]))
      case x of
        (s', m', _) : _ -> load s' m' r
        [] -> load s m r
load s m (input:r) =
  case parseStack input of
    Left e -> print e >> return m
    Right s -> do
      let x = runIdentity $ evalStack (s, m, ([],[]))
      case x of
        (s', m', _) : _ -> load s' m' r
        [] -> load s m r
load s m (input:r) =
  case parseStack input of
    Left e -> print e >> return m
    Right s -> do
      let x = runIdentity $ evalStack (s, m, ([],[]))
      case x of
        (s', m', _) : _ -> load s' m' r
        [] -> load s m r