Commit f11b52d0 authored by Vincent Zweije's avatar Vincent Zweije
Browse files

Add argument index to Force subspine

parent e24dd719
......@@ -159,7 +159,7 @@ in a graph.
:: Subspine sym var pvar
= Cycle // The spine contains a cycle
| Delta // An imported (delta) rule was found
| Force (Spine sym var pvar) // Global strictness annotation forced evaluation of a subgraph
| Force Int (Spine sym var pvar) // Global strictness annotation forced evaluation of a subgraph at specified argument position
| MissingCase // All alternatives failed for a function symbol
| Open (Rgraph sym pvar) // Need root normal form of open node for matching
| Partial (Rule sym pvar) (Pfun pvar var) pvar (Spine sym var pvar) // A rule was strictly partially matched
......@@ -169,18 +169,18 @@ in a graph.
// Fold up a spine using a function for each constructor
foldspine
:: !(var .subresult -> .result)
.subresult
.subresult
(.result -> .subresult)
.subresult
((Rgraph sym pvar) -> .subresult)
((Rule sym pvar) (Pfun pvar var) pvar .result -> .subresult)
((Rgraph sym var) -> .subresult)
((Rule sym pvar) (Pfun pvar var) -> .subresult)
.subresult
.(Spine sym var pvar)
-> .result
:: !(var .subresult -> .result) // Fold the spine itself
.subresult // Fold a Cycle subspine
.subresult // Fold a Delta subspine
(Int .result -> .subresult) // Fold a Force subspine
.subresult // Fold a MissingCase subspine
((Rgraph sym pvar) -> .subresult) // Fold an Open subspine
((Rule sym pvar) (Pfun pvar var) pvar .result -> .subresult) // Fold a Partial subspine
((Rgraph sym var) -> .subresult) // Fold an Unsafe subspine
((Rule sym pvar) (Pfun pvar var) -> .subresult) // Fold a Redex subspine
.subresult // Fold a Strict subspine
.(Spine sym var pvar) // The spine to fold
-> .result // The final result
// Get the tip of a spine,
// i.e. the last part when all Partial's and Force's are stripped.
......
......@@ -147,7 +147,7 @@ in a graph.
= pr
where pr Cycle = "Cycle"
pr Delta = "Delta"
pr (Force spine) = "(Force "++printspine printa printb printc spine++")"
pr (Force argno spine) = "(Force <argno> "++printspine printa printb printc spine++")"
pr MissingCase = "MissingCase"
pr (Open rgraph) = "(Open "++printrgraph printa printc rgraph++")"
pr (Partial rule matching spine) = "(Partial "++printrule printa printc rule++' ':printpfun printc printb matching++' ':printspine printa printb printc spine++")"
......@@ -160,7 +160,7 @@ in a graph.
:: Subspine sym var pvar
= Cycle // The spine contains a cycle
| Delta // An imported (delta) rule was found
| Force (Spine sym var pvar) // Global strictness annotation forced evaluation of a subgraph
| Force Int (Spine sym var pvar) // Global strictness annotation forced evaluation of a subgraph at specified argument position
| MissingCase // All alternatives failed for a function symbol
| Open (Rgraph sym pvar) // Need root normal form of open node for matching
| Partial (Rule sym pvar) (Pfun pvar var) pvar (Spine sym var pvar) // A rule was strictly partially matched
......@@ -203,7 +203,7 @@ foldspine
:: !(var .subresult -> .result)
.subresult
.subresult
(.result -> .subresult)
(Int .result -> .subresult)
.subresult
((Rgraph sym pvar) -> .subresult)
((Rule sym pvar) (Pfun pvar var) pvar .result -> .subresult)
......@@ -220,7 +220,7 @@ foldspine pair cycle delta force missingcase open partial unsafe redex strict sp
where (node,subspine) = spine
foldsub Cycle = cycle
foldsub Delta = delta
foldsub (Force spine) = force (fold spine)
foldsub (Force argno spine) = force argno (fold spine)
foldsub MissingCase = missingcase
foldsub (Open rgraph) = open rgraph
foldsub (Partial rule matching rnode spine) = partial rule matching rnode (fold spine)
......@@ -229,13 +229,13 @@ foldspine pair cycle delta force missingcase open partial unsafe redex strict sp
foldsub Strict = strict
spinetip :: !(Spine sym var pvar) -> Spine sym var pvar
spinetip (_,Force spine) = spinetip spine
spinetip (_,Force argno spine) = spinetip spine
spinetip (_,Partial _ _ pnode spine) = spinetip spine
spinetip spine = spine
spinenodes :: .(Spine sym var pvar) -> [var]
spinenodes spine
= foldspine cons [] [] id [] (const []) partial (const []) redex [] spine
= foldspine cons [] [] (const id) [] (const []) partial (const []) redex [] spine
where partial _ _ _ = id
redex _ _ = []
......
Supports Markdown
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