exprIsHNF is actually checking if its argument is in WHNF
The exprIsHNF
function will not descend into lambdas if they bind run-time variables:
is_hnf_like (Lam b e) = isRuntimeVar b || is_hnf_like e
So the documentation should probably reflect that it actually checks WHNF
, because it currently emphasises that it checks head normal form:
-- | exprIsHNF returns true for expressions that are certainly /already/
-- evaluated to /head/ normal form. This is used to decide whether it's ok
-- to change:
And perhaps we should even change the function name?