Skip to content

WorkWrap: Absent fillers should not be regarded as HNF, but as diverging

In #19595 (comment 341956), @simonpj writes:

I think it's the case that Note [aBSENT_ERROR_ID] is now solving a non-problem. Consider the problematic case of that Note:

data T a = MkT a !a


g :: Int -> T a -> a
g 0 (MkT p q) = p
g n t         = g (n-1) t

f True  x = case x of MkT a b -> g 20 (MkT b a)
f False x = f True x

In the old demand analyser, f has an absent demand on the first component of its x argument. But in the new demand analyser the demand is 1A, which is not entirely absent, and when we w/w f we pass that argument along. So I think the entire issue has gone away and we can remove all the special pleading around absentError. Do you agree? Would you like to try? It'd be a good simplification.

By "removing the special pleading", Simon refers to the changes to exprIsHNF in dbbee1ba, where absentError is regarded as an HNF. The solution is to

  1. Revert part of dbbee1ba, removing the exprIsHNF bits
  2. Making absent errors have proper bottoming strictness signatures, as they used to have.
  3. Introduce some special handling for LitRubbish (in the ball park of SPJ), in particular the Simplifier should discard its continuations. Should we also make it have botDiv/botCPR? Unclear... After all, we put them in strict fields and it would be weird to have a (according to strcitness analysis) bottoming value in a strict field. So I'd rather say we give it special treatment in the Simplifier but nothing more.
Edited by Sebastian Graf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information