diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-08-29 10:19:02 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-08-29 10:21:38 +0100 |
commit | db5868cf0589b36df2948517a47930dd676974a0 (patch) | |
tree | 77f05a5269618935ed63e018e202b4867c2af276 /libraries | |
parent | 8df3159a5a73bb5d5bad754bb5d06082b690a94f (diff) | |
download | haskell-db5868cf0589b36df2948517a47930dd676974a0.tar.gz |
In GHC.Real, specialise 'even' and 'odd' to Int and Integer
This was previously happening by a fluke -- they were called with those types
in GHC.Real itself -- but my recent changes to specialisation mean that auto
specialisations like these are not necessarily exported.
Losing those specialisations made a huge difference to two performance tests
perf/should_run/MethSharing
perf/should_run/T9339
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/Real.lhs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/GHC/Real.lhs b/libraries/base/GHC/Real.lhs index a54818f049..481125aa93 100644 --- a/libraries/base/GHC/Real.lhs +++ b/libraries/base/GHC/Real.lhs @@ -517,6 +517,10 @@ showSigned showPos p x even, odd :: (Integral a) => a -> Bool even n = n `rem` 2 == 0 odd = not . even +{-# SPECIALISE even :: Int -> Bool #-} +{-# SPECIALISE odd :: Int -> Bool #-} +{-# SPECIALISE even :: Integer -> Bool #-} +{-# SPECIALISE odd :: Integer -> Bool #-} ------------------------------------------------------- -- | raise a number to a non-negative integral power |