tptp 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+1/−149 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- test/ParseTPTPLibrary/Main.hs +0/−97
- test/Parser/Main.hs +0/−27
- tptp.cabal +1/−25
− test/ParseTPTPLibrary/Main.hs
@@ -1,97 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE LambdaCase #-}---- |--- Module : Main--- Description : Run the TPTP parser on the entire TPTP library.--- Copyright : (c) Evgenii Kotelnikov, 2019--- License : GPL-3--- Maintainer : evgeny.kotelnikov@gmail.com--- Stability : experimental-----module Main where--import System.Directory-import System.Environment-import System.IO--import Control.Monad.Extra--import Data.List (isSuffixOf)-import Data.Text (Text, isInfixOf)-import Text.Printf-import qualified Data.Text.IO as Text.IO-import Data.TPTP.Parse.Text (parseTPTPOnly)--data Result- = Success- | Failure String- | Skipped- deriving (Show, Eq, Ord)--unsupportedFile :: Text -> Bool-unsupportedFile contents = "thf" `isInfixOf` contents--parseInput :: Text -> Result-parseInput input- | unsupportedFile input = Skipped- | otherwise = either Failure (const Success) (parseTPTPOnly input)--printResult :: Result -> IO ()-printResult = \case- Success -> putStrLn "OK"- Failure e -> putStrLn "FAIL" >> hPutStrLn stderr ("Error: " ++ e)- Skipped -> putStrLn "SKIP"--parseFile :: FilePath -> IO Result-parseFile fp = do- input <- Text.IO.readFile fp- putStr (fp ++ "\t")- let result = parseInput input- printResult result- return result--listDirectory' :: FilePath -> IO [FilePath]-listDirectory' dir = do- files <- listDirectory dir- return [dir ++ "/" ++ file | file <- files]--tptpAxioms :: FilePath -> IO [FilePath]-tptpAxioms libraryPath = listDirectory' (libraryPath ++ "/" ++ "Axioms")--tptpProblems :: FilePath -> IO [FilePath]-tptpProblems libraryPath = listDirectory' (libraryPath ++ "/" ++ "Problems")- >>= concatMapM listDirectory'--tptpSolutions :: FilePath -> IO [FilePath]-tptpSolutions libraryPath = listDirectory' (libraryPath ++ "/" ++ "Solutions")- >>= concatMapM listDirectory'- >>= concatMapM listDirectory'--isTptpFile :: FilePath -> IO Bool-isTptpFile file = do- isFile <- doesFileExist file- return $ isFile && any (`isSuffixOf` file) [".p", ".ax", ".rm", ".s"]--main :: IO ()-main = do- args <- getArgs- let tptpLibraryPath = head args- -- axioms <- tptpAxioms tptpLibraryPath- -- problems <- tptpProblems tptpLibraryPath- solutions <- tptpSolutions tptpLibraryPath- tptpFiles <- filterM isTptpFile solutions -- (axioms ++ problems)- results <- mapM parseFile tptpFiles- let (successful, failed, skipped) = statistic results- let total = successful + failed + skipped- putStrLn $ printf "Total: %d (%d successful, %d failed, %d skipped)"- total successful failed skipped--statistic :: [Result] -> (Int, Int, Int)-statistic = foldl update (0, 0, 0)- where- update (s, f, u) = \case- Success -> (s + 1, f, u)- Failure{} -> (s, f + 1, u)- Skipped -> (s, f, u + 1)
− test/Parser/Main.hs
@@ -1,27 +0,0 @@-module Main where---- |--- Module : Main--- Description : Parse TPTP input either from a file or stdin.--- Copyright : (c) Evgenii Kotelnikov, 2019--- License : GPL-3--- Maintainer : evgeny.kotelnikov@gmail.com--- Stability : experimental-----import System.Environment (getArgs)-import System.Exit (exitSuccess, exitFailure)-import System.IO (stderr, hPutStrLn)-import Data.Maybe (listToMaybe)-import qualified Data.Text.IO as Text.IO-import Data.TPTP.Parse.Text (parseTPTPOnly)--main :: IO ()-main = do- args <- getArgs- input <- case listToMaybe args of- Just f -> Text.IO.readFile f- Nothing -> Text.IO.getContents- case parseTPTPOnly input of- Left e -> hPutStrLn stderr e >> exitFailure- Right _ -> putStrLn "OK" >> exitSuccess
tptp.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: tptp-version: 0.1.0.1+version: 0.1.0.2 synopsis: A parser and a pretty printer for the TPTP language description: <http://www.tptp.org TPTP> (Thousands of Problems for Theorem Provers)@@ -128,27 +128,3 @@ base, QuickCheck, doctest--executable parser- hs-source-dirs: test/Parser- default-language: Haskell2010- main-is: Main.hs- ghc-options:- -Wall -threaded- build-depends:- base >= 4.5 && < 5.0,- text >= 1.2.3 && < 1.3,- tptp--executable parse-tptp-library- hs-source-dirs: test/ParseTPTPLibrary- default-language: Haskell2010- main-is: Main.hs- ghc-options:- -Wall -threaded- build-depends:- base >= 4.5 && < 5.0,- extra >= 1.4.4 && < 1.7,- text >= 1.2.3 && < 1.3,- directory >= 1.2.5 && < 1.4,- tptp