Hey,
I was wondering how difficult it would be to improve handling of casts, as follows: when looking at Core, I see things like
(\ (ds_dcKZ :: Data.TrieMap.TrieKey.TrieMap
(Data.TrieMap.Regular.Base.App f_XcwB k_XcwD) a_acAi) ->
f_scPr
(ds_dcKZ
`cast` (trans
(Data.TrieMap.Regular.App.TFCo:R:TrieMapAppa f_XcwB k_XcwD a_acAi)
(Data.TrieMap.Regular.App.NTCo:R:TrieMapAppa f_XcwB k_XcwD a_acAi)
:: Data.TrieMap.TrieKey.TrieMap
(Data.TrieMap.Regular.Base.App f_XcwB k_XcwD) a_acAi
~
Data.TrieMap.Regular.Class.TrieMapT f_XcwB k_XcwD a_acAi)))
which is equivalent to a single cast of f. I get that generalized newtype deriving does something like this automatically -- unfortunately, at the moment, I'm using a class with associated types, so I can't do that.
How difficult would it be to identify and rewrite these, when they appear in non-recursive lets? (I'm actually experimenting with implementing the change myself, but I've never hacked GHC before, so we'll see how it goes...)