Hi Christiaan,
Wow, the whole OPAQUE pragma proposal and implementation completely slipped my attention.
I left a comment on the proposal about GHC.Exts.{lazy,noinline}.
Regarding the reboxing problem: You might want to wait for
!5790, which represents boxity explicitly in the demand lattice, allowing you to get rid of all boxity info in the demand signature of an OPAQUE function around the call to `mkDmdTypeForArity`.
In the meantime, your best bet is to get rid of any strict product demands in the demand signature, which at the moment says "unbox this thing, because it is used unboxed".
Either way, you shouldn't even need to touch WW if you simply degrade the (demand and CPR) signatures in that way, and it's more compositional, too, because the analysis is able to propagate the "don't unbox" info to callers, whereas it's too late to have non-local impact on callers of the OPAQUE function when WW runs.
I enabled notifications for !5562, so feel free to continue the discussion there.
Sebastian