be less eager in conditional primitives

not quite sure what i was thinking earlier. in `if# c t f`, there is no reason for `t` or `f` to be strict under any circumstance.
This commit is contained in:
crumbtoo
2023-11-14 20:35:38 -07:00
parent 535c059afc
commit ad94413100

View File

@@ -262,18 +262,12 @@ step st =
primStep _ IfP (TiState s d h g sts) = TiState s' d' h' g sts
where
s' | needsEval cn = [c]
| isTrue, needsEval tn = [t]
| not isTrue, needsEval fn = [f]
| otherwise = drop 3 s
d' | needsEval cn = drop 1 s : d
| isTrue, needsEval tn = drop 2 s : d
| not isTrue, needsEval fn = drop 3 s : d
| otherwise = d
h' | needsEval cn = h
| isTrue, needsEval tn = h
| not isTrue, needsEval fn = h
| otherwise =
update h rootAddr (NInd $ if isTrue then t else f)