sizeExpr:size_up_alloc is wrong for unlifted data types.
------------
-- Cost to allocate binding with given binder
size_up_alloc bndr
| isTyVar bndr -- Doesn't exist at runtime
|| isJoinId bndr -- Not allocated at all
|| isUnliftedType (idType bndr) -- Doesn't live in heap
-- OK to call isUnliftedType: binders have a fixed RuntimeRep (search for FRRBinder)
= 0
| otherwise
= 10
This is from GHC.Core.Unfold:581
Unlifted data types very much live in the heap. And so does ByteArray# for what it's worth. It might also be wrong for unboxed tuples but not entirely sure if they get their own handling somewhere else.