Rewriting rules apply to the GHC Core intermediate language (and not to Haskell). By this time, newtype basically disappeared. For example, Identity x becomes x |> c , where c is a constraint that distinguishes x :: Text from the type Identity Text .
These drops can cancel each other, and then the rules can work, as usual. Thus, you should still benefit from the rules for rewriting text, if everything falls into place.
Unfortunately, there are no serious guarantees, and despite the intermediate code (and you know what to look for, for example, if you know a certain place where the merger is supposed to be), you cannot be sure that using Identity does not come here at a price.
source share