main :: IO ()
main = do
  [filePath] <- Env.getArgs
  Sophia.withEnv $ \env -> do
    Sophia.openDir env Sophia.ReadWrite Sophia.AllowCreation filePath
    Sophia.withDb env $ \db ->
      Sophia.withCursor db Sophia.GT empty $ \cursor -> do
        putStrLn "Keys:"
        whileM (Sophia.fetchCursor cursor) $ do
          key <- Sophia.keyAtCursor cursor
          val <- Sophia.valAtCursor cursor
          execLogDoc <-
            E.evaluate (pPrint (decode val :: Db.ExecutionLog))
            `E.catch` \E.SomeException {} -> return "not an execution log"
          putStrLn $ "Key " ++ take 8 (show key) ++ "... = " ++ show execLogDoc
        putStrLn "Done"
main :: IO ()
main = do
  [filePath] <- Env.getArgs
  Sophia.withEnv $ \env -> do
    Sophia.openDir env Sophia.ReadWrite Sophia.AllowCreation filePath
    Sophia.withDb env $ \db ->
      Sophia.withCursor db Sophia.GT empty $ \cursor -> do
        putStrLn "Keys:"
        whileM (Sophia.fetchCursor cursor) $ do
          key <- Sophia.keyAtCursor cursor
          val <- Sophia.valAtCursor cursor
          execLogDoc <-
            E.evaluate (pPrint (decode val :: Db.ExecutionLog))
            `E.catch` \E.SomeException {} -> return "not an execution log"
          putStrLn $ "Key " ++ take 8 (show key) ++ "... = " ++ show execLogDoc
        putStrLn "Done"
main = do
  [filePath] <- Env.getArgs
  Sophia.withEnv $ \env -> do
    Sophia.openDir env Sophia.ReadWrite Sophia.AllowCreation filePath
    Sophia.withDb env $ \db ->
      Sophia.withCursor db Sophia.GT empty $ \cursor -> do
        putStrLn "Keys:"
        whileM (Sophia.fetchCursor cursor) $ do
          key <- Sophia.keyAtCursor cursor
          val <- Sophia.valAtCursor cursor
          execLogDoc <-
            E.evaluate (pPrint (decode val :: Db.ExecutionLog))
            `E.catch` \E.SomeException {} -> return "not an execution log"
          putStrLn $ "Key " ++ take 8 (show key) ++ "... = " ++ show execLogDoc
        putStrLn "Done"