Module CurryCheck

This is the implementation of the currycheck tool. It performs various checks on Curry programs:

  • Correct usage of set functions, non-strict unification, default rules, DET annotations, contracts
  • All EasyCheck tests are extracted and checked
  • For all functions declared as deterministic, determinism properties are generated and checked.
  • For functions with postconditions (f'post), checks for postconditions are generated (together with possible preconditions)
  • For functions with specification (f'spec), checks for satisfaction of these specifications are generated (together with possible preconditions).

Author: Michael Hanus, Jan-Patrick Baye

Version: August 2020

Summary of exported operations:

ccBanner :: String   
usageText :: String   
maxArity :: Int   
Maximal arity of check functions and tuples currently supported:
defTypeSuffix :: String   
postCondSuffix :: String   
satSpecSuffix :: String   
isDetSuffix :: String   
isIOTest :: Test -> Bool   
isUnitTest :: Test -> Bool   
isPropTest :: Test -> Bool   
isEquivTest :: Test -> Bool   
equivTestOps :: Test -> [(String,String)]   
testName :: Test -> (String,String)   
testLine :: Test -> Int   
genTestMsg :: String -> Test -> String   
genTestName :: Test -> String   
staticErrorTestMod :: String -> [String] -> TestModule   
testThisModule :: TestModule -> Bool   
userTestDataOfModule :: TestModule -> [((String,String),Bool)]   
equivPropTypes :: TestModule -> [(String,String)]   
genTestFuncs :: Options -> ((String,String) -> Bool) -> ((String,String) -> Productivity) -> String -> TestModule -> IO [CFuncDecl]   
easyCheckConfig :: Options -> (String,String)   
type2genop :: String -> TestModule -> Bool -> CTypeExpr -> CExpr   
isFloatType :: CTypeExpr -> Bool   
typename2genopname :: String -> [(String,String)] -> (String,String) -> (String,String)   
transQN :: String -> String   
transFuncArgsInProp :: String -> [CTypeExpr] -> CExpr -> CExpr   
makeAllPublic :: CurryProg -> CurryProg   
classifyTest :: Options -> CurryProg -> CFuncDecl -> Test   
transformTests :: Options -> [String] -> [CFuncDecl] -> CurryProg -> IO ([CFuncDecl],[CFuncDecl],[(String,String)],CurryProg)   
transformDetTests :: Options -> [String] -> CurryProg -> ([CFuncDecl],[CFuncDecl],CurryProg)   
preCondOperations :: [CFuncDecl] -> [(String,String)]   
funDeclsWith :: (String -> Bool) -> [CFuncDecl] -> [CFuncDecl]   
propResultType :: CTypeExpr -> CTypeExpr   
genPostCondTest :: [(String,String)] -> [(String,String)] -> [String] -> CFuncDecl -> [CFuncDecl]   
genSpecTest :: Options -> [(String,String)] -> [(String,String)] -> [String] -> CFuncDecl -> [CFuncDecl]   
genSpecGroundEquivTest :: [(String,String)] -> (String,String) -> CContext -> CTypeExpr -> CFuncDecl   
addPreCond :: [(String,String)] -> [(String,String)] -> [(Int,String)] -> CExpr -> CExpr   
revertDetOpTrans :: [(String,String)] -> CFuncDecl -> CFuncDecl   
genDetOpTests :: [String] -> [(String,String)] -> [CFuncDecl] -> [CFuncDecl]   
genDetProp :: [(String,String)] -> CFuncDecl -> CFuncDecl   
poly2default :: Options -> CFuncDecl -> [(Bool,CFuncDecl)]   
poly2defaultType :: Options -> CTypeExpr -> CTypeExpr   
defaultQualType :: CQualTypeExpr -> CQualTypeExpr   
addShowContext :: CContext -> CContext   
addEqShowContext :: (Int,String) -> CContext -> CContext   
orgTestName :: (String,String) -> (String,String)   
orgQName :: (String,String) -> (String,String)   
analyseModule :: Options -> String -> IO [TestModule]   
staticProgAnalysis :: Options -> String -> String -> CurryProg -> IO ([String],[((String,String),String)])   
analyseCurryProg :: Options -> String -> CurryProg -> IO [TestModule]   
generatorsOfProg :: CurryProg -> [(String,String)]   
genBottomType :: String -> TypeDecl -> CTypeDecl   
isPrimExtType :: (String,String) -> Bool   
defaultValueOfBasicExtType :: String -> CLiteral   
ctype2BotType :: String -> Bool -> CTypeExpr -> CTypeExpr   
t2bt :: String -> String   
genPeval :: String -> TypeDecl -> CFuncDecl   
genPValOf :: String -> TypeDecl -> CFuncDecl   
ftype2pvalOf :: String -> String -> [(Int,String)] -> TypeExpr -> CExpr   
ctype2typeop :: String -> String -> CTypeExpr -> CExpr   
genShowP :: String -> TypeDecl -> CInstanceDecl   
genFromP :: String -> TypeDecl -> CFuncDecl   
ftype2fromP :: String -> String -> [(Int,String)] -> TypeExpr -> CExpr   
ctypedecl2ftypedecl :: CTypeDecl -> TypeDecl   
genMainTestModule :: Options -> String -> [TestModule] -> IO [Test]   
genMainFunction :: Options -> String -> [CFuncDecl] -> CFuncDecl   
removeNonExecTests :: Options -> ((String,String) -> [String]) -> [TestModule] -> ([TestModule],[(String,String)])   
collectAllTestTypeDecls :: Options -> [Prog] -> [(TypeDecl,Bool)] -> [((String,String),Bool)] -> IO ([Prog],[(TypeDecl,Bool)])   
genTestDataGenerator :: String -> TypeDecl -> CFuncDecl   
genPartialPrimDataGenerator :: String -> (String,String) -> CFuncDecl   
cleanup :: Options -> String -> [TestModule] -> IO ()   
printTestStatistics :: Options -> [String] -> String -> Int -> [Test] -> IO ()   
main :: IO ()   
showGeneratedModule :: Options -> String -> String -> IO ()   
renameProp2EasyCheck :: CurryProg -> CurryProg   
firstWord :: String -> String   
stripSuffix :: String -> String -> String   
modNameToId :: String -> String   
arityOfType :: CTypeExpr -> Int   
searchTreeModule :: String   
Name of the SearchTree module.
searchTreeTC :: (String,String)   
Name of SearchTree type constructor.
generatorModule :: String   
Name of the SearchTreeGenerator module.
choiceGen :: (String,String)   
writeCurryProgram :: Options -> String -> CurryProg -> String -> IO ()   
isPAKCS :: Bool   
containsPPOptionLine :: String -> Bool   
tconsOf :: CTypeExpr -> [(String,String)]   
unionOn :: Eq a => (b -> [a]) -> [b] -> [a]   
showCTypeExpr :: CTypeExpr -> String   
showCExpr :: CExpr -> String   
cLambda :: [CPattern] -> CExpr -> CExpr   

Exported datatypes:


Test

Constructors:


TestModule

Constructors:

  • TestModule :: String -> String -> [String] -> [Test] -> [QName] -> [QName] -> TestModule

    Fields:

    • orgModuleName :: String
    • testModuleName :: String
    • staticErrors :: [String]
    • propTests :: [Test]
    • generators :: [QName]
    • preConditions :: [QName]

Exported operations:

ccBanner :: String   

usageText :: String   

maxArity :: Int   

Maximal arity of check functions and tuples currently supported:

Further infos:
  • solution complete, i.e., able to compute all solutions

defTypeSuffix :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

postCondSuffix :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

satSpecSuffix :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

isDetSuffix :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

isIOTest :: Test -> Bool   

isUnitTest :: Test -> Bool   

isPropTest :: Test -> Bool   

isEquivTest :: Test -> Bool   

equivTestOps :: Test -> [(String,String)]   

testName :: Test -> (String,String)   

Further infos:
  • solution complete, i.e., able to compute all solutions

testLine :: Test -> Int   

Further infos:
  • solution complete, i.e., able to compute all solutions

genTestMsg :: String -> Test -> String   

genTestName :: Test -> String   

staticErrorTestMod :: String -> [String] -> TestModule   

Further infos:
  • solution complete, i.e., able to compute all solutions

testThisModule :: TestModule -> Bool   

Further infos:
  • solution complete, i.e., able to compute all solutions

userTestDataOfModule :: TestModule -> [((String,String),Bool)]   

equivPropTypes :: TestModule -> [(String,String)]   

genTestFuncs :: Options -> ((String,String) -> Bool) -> ((String,String) -> Productivity) -> String -> TestModule -> IO [CFuncDecl]   

easyCheckConfig :: Options -> (String,String)   

type2genop :: String -> TestModule -> Bool -> CTypeExpr -> CExpr   

isFloatType :: CTypeExpr -> Bool   

typename2genopname :: String -> [(String,String)] -> (String,String) -> (String,String)   

transQN :: String -> String   

transFuncArgsInProp :: String -> [CTypeExpr] -> CExpr -> CExpr   

transformTests :: Options -> [String] -> [CFuncDecl] -> CurryProg -> IO ([CFuncDecl],[CFuncDecl],[(String,String)],CurryProg)   

transformDetTests :: Options -> [String] -> CurryProg -> ([CFuncDecl],[CFuncDecl],CurryProg)   

preCondOperations :: [CFuncDecl] -> [(String,String)]   

funDeclsWith :: (String -> Bool) -> [CFuncDecl] -> [CFuncDecl]   

genPostCondTest :: [(String,String)] -> [(String,String)] -> [String] -> CFuncDecl -> [CFuncDecl]   

genSpecTest :: Options -> [(String,String)] -> [(String,String)] -> [String] -> CFuncDecl -> [CFuncDecl]   

genSpecGroundEquivTest :: [(String,String)] -> (String,String) -> CContext -> CTypeExpr -> CFuncDecl   

addPreCond :: [(String,String)] -> [(String,String)] -> [(Int,String)] -> CExpr -> CExpr   

revertDetOpTrans :: [(String,String)] -> CFuncDecl -> CFuncDecl   

genDetOpTests :: [String] -> [(String,String)] -> [CFuncDecl] -> [CFuncDecl]   

genDetProp :: [(String,String)] -> CFuncDecl -> CFuncDecl   

poly2default :: Options -> CFuncDecl -> [(Bool,CFuncDecl)]   

poly2defaultType :: Options -> CTypeExpr -> CTypeExpr   

Further infos:
  • solution complete, i.e., able to compute all solutions

addEqShowContext :: (Int,String) -> CContext -> CContext   

orgTestName :: (String,String) -> (String,String)   

orgQName :: (String,String) -> (String,String)   

analyseModule :: Options -> String -> IO [TestModule]   

staticProgAnalysis :: Options -> String -> String -> CurryProg -> IO ([String],[((String,String),String)])   

analyseCurryProg :: Options -> String -> CurryProg -> IO [TestModule]   

generatorsOfProg :: CurryProg -> [(String,String)]   

genBottomType :: String -> TypeDecl -> CTypeDecl   

isPrimExtType :: (String,String) -> Bool   

ctype2BotType :: String -> Bool -> CTypeExpr -> CTypeExpr   

t2bt :: String -> String   

genPeval :: String -> TypeDecl -> CFuncDecl   

genPValOf :: String -> TypeDecl -> CFuncDecl   

ftype2pvalOf :: String -> String -> [(Int,String)] -> TypeExpr -> CExpr   

ctype2typeop :: String -> String -> CTypeExpr -> CExpr   

genShowP :: String -> TypeDecl -> CInstanceDecl   

genFromP :: String -> TypeDecl -> CFuncDecl   

ftype2fromP :: String -> String -> [(Int,String)] -> TypeExpr -> CExpr   

genMainTestModule :: Options -> String -> [TestModule] -> IO [Test]   

genMainFunction :: Options -> String -> [CFuncDecl] -> CFuncDecl   

removeNonExecTests :: Options -> ((String,String) -> [String]) -> [TestModule] -> ([TestModule],[(String,String)])   

collectAllTestTypeDecls :: Options -> [Prog] -> [(TypeDecl,Bool)] -> [((String,String),Bool)] -> IO ([Prog],[(TypeDecl,Bool)])   

genTestDataGenerator :: String -> TypeDecl -> CFuncDecl   

genPartialPrimDataGenerator :: String -> (String,String) -> CFuncDecl   

cleanup :: Options -> String -> [TestModule] -> IO ()   

printTestStatistics :: Options -> [String] -> String -> Int -> [Test] -> IO ()   

main :: IO ()   

showGeneratedModule :: Options -> String -> String -> IO ()   

firstWord :: String -> String   

stripSuffix :: String -> String -> String   

modNameToId :: String -> String   

arityOfType :: CTypeExpr -> Int   

searchTreeModule :: String   

Name of the SearchTree module.

Further infos:
  • solution complete, i.e., able to compute all solutions

searchTreeTC :: (String,String)   

Name of SearchTree type constructor.

Further infos:
  • solution complete, i.e., able to compute all solutions

generatorModule :: String   

Name of the SearchTreeGenerator module.

Further infos:
  • solution complete, i.e., able to compute all solutions

choiceGen :: (String,String)   

Further infos:
  • solution complete, i.e., able to compute all solutions

writeCurryProgram :: Options -> String -> CurryProg -> String -> IO ()   

isPAKCS :: Bool   

containsPPOptionLine :: String -> Bool   

tconsOf :: CTypeExpr -> [(String,String)]   

unionOn :: Eq a => (b -> [a]) -> [b] -> [a]   

showCTypeExpr :: CTypeExpr -> String   

showCExpr :: CExpr -> String   

cLambda :: [CPattern] -> CExpr -> CExpr