CBV-convention for dataToTag#
Ticket #21497 (closed) proposes marking some functions as CBV-Ids. A caller of a function marked as CBV-Id is responsible to pass all strict arguments in an evaluated, properly-tagged form.
During a call, Simon suggested that dataToTag# could use the same machinery. dataToTag# is very similar to a strict datacon worker: it needs an evaluated argument.
In the past, we had a wrapper
getTag !x = dataToTag# x
in GHC.Exts, which made sure that dataToTag# receives an evaluated argument. However, as shown in #15696 (closed) (ac977688), this was not enough and dataToTag# now evaluates its argument directly. With the notion of CBV-Id from #21497 (closed), we could rollback this change and make dataToTag# less magical.
To implement this, we'd have to add a wrapper around the primop. We could reuse getTag in GHC.Exts as it was done in the past, or combine the change with #20532 (closed) which adds a typeclass for validity checking. In that case, the wrapping code would be created in the constraint solver.