Constant folding for ^ and ^^
Motivation
#15842 will introduce (built-in / PrelRules
) rewriting rules for ^
, ^^
and stimes
. We will be able to match these functions and their arguments, so we should be able to do constant folding on them, too.
While (IMHO) constant folding stimes
might be dangerous regarding laziness and heap usage, c1 ^ c2
and c1 ^^ c2
should be safely replaceable by their calculated values.
Proposal
Write built-in rules in PrelRules
, that match ^
and ^^
very much like the rules in #15842 , but if both arguments are constants, let the rewritten expression be the result of the calculation.