From 67a4d29dd27fd3d353b234465709a408be019635 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Tue, 17 Dec 2024 16:50:38 -0800 Subject: [PATCH] fixup errors --- src/Cryptol/Project/Cache.hs | 2 +- src/Cryptol/Project/Config.hs | 7 +------ src/Cryptol/REPL/Command.hs | 17 +++++++---------- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Cryptol/Project/Cache.hs b/src/Cryptol/Project/Cache.hs index 1ec7e3338..542f3da23 100644 --- a/src/Cryptol/Project/Cache.hs +++ b/src/Cryptol/Project/Cache.hs @@ -105,7 +105,7 @@ data FullFingerprint = FullFingerprint -- XXX: This should probably be a parameter metaDir, loadCachePath :: FilePath metaDir = ".cryproject" -loadCachePath = metaDir FP. "loadcache" +loadCachePath = metaDir FP. "loadcache.toml" emptyLoadCache :: LoadCache emptyLoadCache = LoadCache { cacheModules = mempty } diff --git a/src/Cryptol/Project/Config.hs b/src/Cryptol/Project/Config.hs index 697b3cbee..d2fa7e9fb 100644 --- a/src/Cryptol/Project/Config.hs +++ b/src/Cryptol/Project/Config.hs @@ -37,10 +37,7 @@ data ConfigLoadErrorInfo instance PP ConfigLoadError where ppPrec _ (ConfigLoadError path info) = case info of - ConfigParseError errs -> text $ unlines errs -{- - show topMsg ++ prettyPosWithSource pos file "\nParse error:" ++ err --} + ConfigParseError errs -> text (unlines errs) SetRootFailed ioe -> hang topMsg 4 (hang "Failed to set project root:" @@ -63,5 +60,3 @@ loadConfig path = tryIOError do setCurrentDirectory (takeDirectory filePath FP. root config) pure config - - diff --git a/src/Cryptol/REPL/Command.hs b/src/Cryptol/REPL/Command.hs index 0d315c2d0..ab79307ba 100644 --- a/src/Cryptol/REPL/Command.hs +++ b/src/Cryptol/REPL/Command.hs @@ -1594,7 +1594,7 @@ getPrimMap = liftModuleCmd M.getPrimMap liftModuleCmd :: M.ModuleCmd a -> REPL a liftModuleCmd cmd = moduleCmdResult =<< io . cmd =<< getModuleInput --- TODO: add filter for my exhaustie prop guards warning here +-- TODO: add filter for my exhaustive prop guards warning here printModuleWarnings :: [M.ModuleWarning] -> REPL () printModuleWarnings ws0 = do @@ -2259,17 +2259,17 @@ loadProjectREPL cfg = M.InFile path -> case v of Proj.Invalid e -> - do rPutStrLn ("Failed to process module: " ++ path ++ ":\n" ++ ppInvalidStatus e) + do rPrint ("Failed to process module: " <> text path <> ":" $$ ppInvalidStatus e) pure (fpAcc, False) -- report failure Proj.Scanned Proj.Unchanged _ ((m,_):_) -> do let name = P.thing (P.mName m) - rPutStrLn ("Skipping unmodified module: " ++ show (pp name)) + rPrint ("Skipping unmodified module: " <> pp name) let prevResult = join (Map.lookup (Proj.CacheInFile path) docstringResults) let fpAcc' = Map.adjust (\e -> e{ Proj.cacheDocstringResult = prevResult }) (Proj.CacheInFile path) fpAcc pure (fpAcc', success) -- preserve success Proj.Scanned Proj.Changed _ ((m,_):_) -> do let name = P.thing (P.mName m) - rPutStrLn ("Checking docstrings on changed module: " ++ show (pp name)) + rPrint ("Checking docstrings on changed module: " <> pp name) checkRes <- checkModName name let fpAcc' = Map.adjust (\fp -> fp { Proj.cacheDocstringResult = Just (crSuccess checkRes) }) (Proj.CacheInFile path) fpAcc pure (fpAcc', success && crSuccess checkRes) @@ -2291,10 +2291,7 @@ loadProjectREPL cfg = io (Proj.saveLoadCache (Proj.LoadCache cache)) pure emptyCommandResult { crSuccess = success } -ppInvalidStatus :: Proj.InvalidStatus -> String +ppInvalidStatus :: Proj.InvalidStatus -> Doc ppInvalidStatus = \case - Proj.InvalidModule modErr -> indentStr (show (pp modErr)) - Proj.InvalidDep d _ -> indentStr ("Error in dependency: " ++ show (pp d)) - -indentStr :: String -> String -indentStr = unlines . map (" "++) . lines + Proj.InvalidModule modErr -> pp modErr + Proj.InvalidDep d _ -> "Error in dependency: " <> pp d