|  I wonder why that is? What changed between GHC 8.10.3 and 9.0.1? Was
|  the definition of `elem` changed in `base`?

I'm not sure... you could investigate, but I'm inclined just to declare victory!

S

|  -----Original Message-----
|  From: ÉRDI Gergő <ge...@erdi.hu>
|  Sent: 12 March 2021 10:02
|  To: Simon Peyton Jones <simo...@microsoft.com>
|  Cc: GHC Devs <ghc-devs@haskell.org>
|  Subject: RE: Inlining of `any @[]` vs `elem @[]`
|  
|  On Thu, 11 Mar 2021, Simon Peyton Jones wrote:
|  
|  > With HEAD, and -O, I get the exact same (good code) for these two
|  functions:
|  >
|  >    f x = any (x ==) [1, 5, 7::Int]
|  >
|  >    g x = elem x [2, 6, 9 :: Int]
|  >
|  > Maybe this is fixed?  If you think not, maybe open a ticket?
|  
|  OK, so initially I tried it on GHC 8.10.3, which is where `elem @[]`
|  is not optimized. I have now tried on GHC 9.0.1, where, just like you
|  see on HEAD, indeed it gets it right.
|  
|  I wonder why that is? What changed between GHC 8.10.3 and 9.0.1? Was
|  the definition of `elem` changed in `base`?
|  
|  Thanks,
|       Gergo
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to