log :: Show a => String -> Controller' st a -> Controller' st a
log msg action = do
  liftIO $ putStrLn $ "> " ++ msg ++ "..."
  val <- action `catchError` printError
  liftIO $ putStrLn $ "< " ++ show val
  return val
  where
    printError err = do
      liftIO $ putStrLn $ "ERROR: " ++ show err
      throwError err
log :: Show a => String -> Controller' st a -> Controller' st a
log msg action = do
  liftIO $ putStrLn $ "> " ++ msg ++ "..."
  val <- action `catchError` printError
  liftIO $ putStrLn $ "< " ++ show val
  return val
  where
    printError err = do
      liftIO $ putStrLn $ "ERROR: " ++ show err
      throwError err
log msg action = do
  liftIO $ putStrLn $ "> " ++ msg ++ "..."
  val <- action `catchError` printError
  liftIO $ putStrLn $ "< " ++ show val
  return val
  where
    printError err = do
      liftIO $ putStrLn $ "ERROR: " ++ show err
      throwError err