Correct me if I'm wrong here, but it's preserving the effect of (==) forcing its arguments. This makes the optimization less surprising, in my opinion.
Is there a benefit to not doing this? On Sat, May 20, 2017 at 11:56 AM, Joachim Breitner <[email protected]> wrote: > Hi, > > I just observed that GHC optimizes > > fun (n::Int) = n == 0 + n > > to essentially > > fun (n::Int) = n `seq` True > > > I am wondering under what circumstances we would be happy to transform > this further to > > fun _ = True > > > Clearly, we do not want to drop `seq`s in general. But is there some > commonly accepted rule about which strictness we generally allow the > compiler to get rid of, if it turns out that the compiler can do > without? Or are all such transformations out of bounds for GHC? > > Greetings, > Joachim > > -- > Joachim Breitner > [email protected] > http://www.joachim-breitner.de/ > > _______________________________________________ > ghc-devs mailing list > [email protected] > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -- Chris Allen Currently working on http://haskellbook.com _______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
