Optimize dataToTag# to do more work at compile time.
Currently the code for dataToTag# is a bit odd.
-
We check at runtime if the constructor tag is too large to be stored in the ptr tag. This should only be done at runtime if the result type is a large constructor family. This would break dataToTag# (unsafeCoerce# (x :: LargeConFamType) :: SmallConFamType)
but we don't consider this a sound use of unsafeCoerce# anyway. Turn this into a compile time check. -
Make use of the tagSig/lfInfo to check if the argument is already tagged. -
Share the two code paths which take the constructor tag from the info table.