proc :: Store s => ByteString -> Act s ()
proc ss = case parseLines ss of
  Left err -> case "unexpected \'\\NUL\'"`isInfixOf`err of
    True -> do
      ev ss
    False -> do
      outputStrLn $ unpack err
      ev ""
  Right e -> do
    s <- lift $ get
    let
      (r,s') = flip runState s $ runExceptT $ case e of
        Left d -> Left <$> ixDecl d
        Right x -> Right <$> ixExpr x
    s'' <- case r of
      Left f -> do
        outputStrLn $ unpack f
        return s'
      Right (Left d') -> return s'
      Right (Right e') -> do
        let
          v = fst $ apply e'
          hdl :: MonadIO m => a -> SomeException -> InputT m a
          hdl a _ = outputStrLn "[Interrupt]" >> return a
        handle (hdl s') $ do
          outputStrLn $ show v
          return $ case s' of
            Status a u -> Status a $ append "it" Nothing v u
    lift $ put s''
    ev ""
proc :: Store s => ByteString -> Act s ()
proc ss = case parseLines ss of
  Left err -> case "unexpected \'\\NUL\'"`isInfixOf`err of
    True -> do
      ev ss
    False -> do
      outputStrLn $ unpack err
      ev ""
  Right e -> do
    s <- lift $ get
    let
      (r,s') = flip runState s $ runExceptT $ case e of
        Left d -> Left <$> ixDecl d
        Right x -> Right <$> ixExpr x
    s'' <- case r of
      Left f -> do
        outputStrLn $ unpack f
        return s'
      Right (Left d') -> return s'
      Right (Right e') -> do
        let
          v = fst $ apply e'
          hdl :: MonadIO m => a -> SomeException -> InputT m a
          hdl a _ = outputStrLn "[Interrupt]" >> return a
        handle (hdl s') $ do
          outputStrLn $ show v
          return $ case s' of
            Status a u -> Status a $ append "it" Nothing v u
    lift $ put s''
    ev ""
proc ss = case parseLines ss of
  Left err -> case "unexpected \'\\NUL\'"`isInfixOf`err of
    True -> do
      ev ss
    False -> do
      outputStrLn $ unpack err
      ev ""
  Right e -> do
    s <- lift $ get
    let
      (r,s') = flip runState s $ runExceptT $ case e of
        Left d -> Left <$> ixDecl d
        Right x -> Right <$> ixExpr x
    s'' <- case r of
      Left f -> do
        outputStrLn $ unpack f
        return s'
      Right (Left d') -> return s'
      Right (Right e') -> do
        let
          v = fst $ apply e'
          hdl :: MonadIO m => a -> SomeException -> InputT m a
          hdl a _ = outputStrLn "[Interrupt]" >> return a
        handle (hdl s') $ do
          outputStrLn $ show v
          return $ case s' of
            Status a u -> Status a $ append "it" Nothing v u
    lift $ put s''
    ev ""