1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
module PropertyUsage
( isProperty, isPropType, isPropIOType, isEquivProperty
, propModule, propTypesModule, easyCheckModule, easyCheckExecModule
) where
import AbstractCurry.Types
import AbstractCurry.Select ( funcName, funcRules, funcType, resultType
, typeOfQualType )
isProperty :: CFuncDecl -> Bool
isProperty = isPropertyType . typeOfQualType . funcType
where
isPropertyType ct = isPropIOType ct || isPropType (resultType ct)
isPropType :: CTypeExpr -> Bool
isPropType texp = case texp of
CTCons (mn,tc) -> tc == "Prop" && mn == propTypesModule
_ -> False
isPropIOType :: CTypeExpr -> Bool
isPropIOType texp = case texp of
CTCons (mn,tc) -> tc == "PropIO" && mn == propTypesModule
_ -> False
isEquivProperty :: CFuncDecl -> Maybe (CExpr,CExpr)
isEquivProperty fdecl =
case funcRules fdecl of
[CRule args (CSimpleRhs (CApply (CApply (CSymbol prop) e1) e2) [])]
-> if isEquivSymbol prop
then
if null args
then Just (e1,e2)
else error $ "Illegal equivalence property '" ++
snd (funcName fdecl) ++ "':\n" ++
"Non-empty parameter list!"
else Nothing
_ -> Nothing
where
isEquivSymbol (qn,mn) = isCheckModule qn && mn=="<=>"
isCheckModule :: String -> Bool
isCheckModule mn = mn == propModule || mn == easyCheckModule
propModule :: String
propModule = "Test.Prop"
propTypesModule :: String
propTypesModule = "Test.Prop.Types"
easyCheckModule :: String
easyCheckModule = "Test.EasyCheck"
easyCheckExecModule :: String
easyCheckExecModule = "Test.EasyCheck.Exec"
|