Hi Alexis, Nested casts shouldn't happen. The mkCast function gets rid of them. Someone somewhere is forgetting to call it. If you have a concrete program that leads to nested casts, post a bug report. :)
Thanks! Richard > On Apr 27, 2020, at 8:29 PM, Alexis King <[email protected]> wrote: > > This question is spurred by curiosity more than anything else, but > I’ve noticed that the simple optimizer doesn’t fuse nested casts, and > I’m wondering if there’s any reason it couldn’t. To make what I’m > talking about more concrete, suppose we have an expression like this: > > (x |> co) |> sym co > > It seems like it would be trivial for simpleOptExpr to fuse the nested > casts to get > > x |> co; sym co > > and then the coercion optimizer could get rid of it entirely. > Moreover, this seems within the spirit of the simple optimizer, since > it’s really just “cleaning up” an expression. Is there any reason the > simple optimizer doesn’t do this, or is it just something nobody > implemented? > > (For context, I’ve recently been staring at a lot of -ddump-ds output, > and there happen to be a bunch of nested casts in the result that are > really just noise. It would be nice if the simple optimizer got rid of > them for me.) > > Alexis > _______________________________________________ > ghc-devs mailing list > [email protected] > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs _______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
