Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry
curry-tools
Commits
2fe12095
Commit
2fe12095
authored
Jan 05, 2020
by
Kai-Oliver Prott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace (=:=) with the new 'constrEq' instead (no dict argument)
parent
6e508561
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
optimize/src/BindingOpt.curry
optimize/src/BindingOpt.curry
+6
-6
No files found.
optimize/src/BindingOpt.curry
View file @
2fe12095
...
...
@@ -193,7 +193,7 @@ transformFuncDecl lookupreqinfo fdecl@(Func qf@(_,fn) ar vis texp rule) =
-------------------------------------------------------------------------
-- State threaded through the program transformer:
-- * 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
initTState :: QName -> TState
...
...
@@ -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`
--- is required, then this occurrence is replaced by
---
--- (
e1=:=
e2)
--- (
constrEq e1
e2)
---
--- 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 _ tst (External s) = (tst, External s)
...
...
@@ -227,11 +227,11 @@ transformRule lookupreqinfo tstr (Rule args rhs) =
transformExp tst (Lit v) _ = (Lit v, tst)
transformExp tst0 exp@(Comb ct qf es) reqval
| reqval == aTrue && isBoolEqualCall "==" exp
= (Comb FuncCall (pre "
=:=
") (argsOfBoolEqualCall "==" (Comb ct qf tes))
= (Comb FuncCall (pre "
constrEq
") (argsOfBoolEqualCall "==" (Comb ct qf tes))
, incOccNumber tst1)
| reqval == aFalse && isBoolEqualCall "/=" exp
= (Comb FuncCall (pre "not")
[Comb FuncCall (pre "
=:=
") (argsOfBoolEqualCall "/=" (Comb ct qf tes))]
[Comb FuncCall (pre "
constrEq
") (argsOfBoolEqualCall "/=" (Comb ct qf tes))]
, incOccNumber tst1)
| qf == pre "$" && length es == 2 &&
(isFuncPartCall (head es) || isConsPartCall (head es))
...
...
@@ -478,7 +478,7 @@ statSummary = concatMap showSum
then ""
else "Function "++fn++": "++
(if teqs==1 then "one occurrence" else show teqs++" occurrences") ++
" of (==) transformed into
(=:=)
\n"
" of (==) transformed into
'constrEq'
\n"
--- Translate statistics into CSV format:
stats2csv :: [TransStat] -> [[String]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment