Closed konsumlamm closed 1 year ago
Those are maps over lists, which should be rewritten to coerce
by RULES
in GHC.base
.
Yes, there's a rule for map coerce
, but I'd rather not rely on that. In most cases it seems to be inlined, but there is at least one case where an fmap Down
(on Maybe
) is not optimized out.
Interesting. There's no fmap/coerce
rule for Maybe
, but I'd have expected that fmap
to inline. Why doesn't it?
Interesting. There's no
fmap/coerce
rule forMaybe
, but I'd have expected thatfmap
to inline. Why doesn't it?
It does inline, but it doesn't reduce to coerce
, it still matches the Maybe
.
How odd! That likely will get cleaned up in the Cmm, but I suggest filing a GHC ticket anyway. Just making sure: you're looking at the compiled code and not the unfolding, right?
I'm looking at the core, I always supress the unfoldings anyway.
So ... GHC ticket it is.
Did you end up opening a GHC ticket for this, or shall I?
I didn't, feel free to open one.
Since
Down
is a newtype, it's possible to usecoerce
instead offmap unDown
/fmap Down
.