Commit 2fe12095 authored by Kai-Oliver Prott's avatar Kai-Oliver Prott

Replace (=:=) with the new 'constrEq' instead (no dict argument)

parent 6e508561
...@@ -193,7 +193,7 @@ transformFuncDecl lookupreqinfo fdecl@(Func qf@(_,fn) ar vis texp rule) = ...@@ -193,7 +193,7 @@ transformFuncDecl lookupreqinfo fdecl@(Func qf@(_,fn) ar vis texp rule) =
------------------------------------------------------------------------- -------------------------------------------------------------------------
-- State threaded through the program transformer: -- State threaded through the program transformer:
-- * name of current function -- * name of current function
-- * number of occurrences of (==) that are replaced by (=:=) -- * number of occurrences of (==) that are replaced by 'constrEq'
data TState = TState QName Int data TState = TState QName Int
initTState :: QName -> TState initTState :: QName -> TState
...@@ -210,11 +210,11 @@ incOccNumber (TState qf on) = TState qf (on+1) ...@@ -210,11 +210,11 @@ incOccNumber (TState qf on) = TState qf (on+1)
--- values. If there is an occurrence of (e1==e2) where the value `True` --- values. If there is an occurrence of (e1==e2) where the value `True`
--- is required, then this occurrence is replaced by --- is required, then this occurrence is replaced by
--- ---
--- (e1=:=e2) --- (constrEq e1 e2)
--- ---
--- Similarly, (e1/=e2) with required value `False` is replaced by --- Similarly, (e1/=e2) with required value `False` is replaced by
--- ---
--- (not (e1=:=e2)) --- (not (constrEq e1 e2))
transformRule :: (QName -> Maybe AFType) -> TState -> Rule -> (TState,Rule) transformRule :: (QName -> Maybe AFType) -> TState -> Rule -> (TState,Rule)
transformRule _ tst (External s) = (tst, External s) transformRule _ tst (External s) = (tst, External s)
...@@ -227,11 +227,11 @@ transformRule lookupreqinfo tstr (Rule args rhs) = ...@@ -227,11 +227,11 @@ transformRule lookupreqinfo tstr (Rule args rhs) =
transformExp tst (Lit v) _ = (Lit v, tst) transformExp tst (Lit v) _ = (Lit v, tst)
transformExp tst0 exp@(Comb ct qf es) reqval transformExp tst0 exp@(Comb ct qf es) reqval
| reqval == aTrue && isBoolEqualCall "==" exp | reqval == aTrue && isBoolEqualCall "==" exp
= (Comb FuncCall (pre "=:=") (argsOfBoolEqualCall "==" (Comb ct qf tes)) = (Comb FuncCall (pre "constrEq") (argsOfBoolEqualCall "==" (Comb ct qf tes))
, incOccNumber tst1) , incOccNumber tst1)
| reqval == aFalse && isBoolEqualCall "/=" exp | reqval == aFalse && isBoolEqualCall "/=" exp
= (Comb FuncCall (pre "not") = (Comb FuncCall (pre "not")
[Comb FuncCall (pre "=:=") (argsOfBoolEqualCall "/=" (Comb ct qf tes))] [Comb FuncCall (pre "constrEq") (argsOfBoolEqualCall "/=" (Comb ct qf tes))]
, incOccNumber tst1) , incOccNumber tst1)
| qf == pre "$" && length es == 2 && | qf == pre "$" && length es == 2 &&
(isFuncPartCall (head es) || isConsPartCall (head es)) (isFuncPartCall (head es) || isConsPartCall (head es))
...@@ -478,7 +478,7 @@ statSummary = concatMap showSum ...@@ -478,7 +478,7 @@ statSummary = concatMap showSum
then "" then ""
else "Function "++fn++": "++ else "Function "++fn++": "++
(if teqs==1 then "one occurrence" else show teqs++" occurrences") ++ (if teqs==1 then "one occurrence" else show teqs++" occurrences") ++
" of (==) transformed into (=:=)\n" " of (==) transformed into 'constrEq'\n"
--- Translate statistics into CSV format: --- Translate statistics into CSV format:
stats2csv :: [TransStat] -> [[String]] stats2csv :: [TransStat] -> [[String]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment