[Git][ghc/ghc][wip/buggymcbugfix/15185-enum-int] Add inline pragmas to Enum methods

Vilem-Benjamin Liepelt gitlab at gitlab.haskell.org
Mon May 11 22:13:26 UTC 2020



Vilem-Benjamin Liepelt pushed to branch wip/buggymcbugfix/15185-enum-int at Glasgow Haskell Compiler / GHC


Commits:
951b8eda by Vilem Liepelt at 2020-05-12T01:12:53+03:00
Add inline pragmas to Enum methods

Fixes t15185

- - - - -


1 changed file:

- libraries/base/GHC/Enum.hs


Changes:

=====================================
libraries/base/GHC/Enum.hs
=====================================
@@ -139,11 +139,22 @@ class  Enum a   where
     --     * @enumFromThenTo 6 8 2 :: [Int] = []@
     enumFromThenTo      :: a -> a -> a -> [a]
 
-    succ                   = toEnum . (+ 1)  . fromEnum
-    pred                   = toEnum . (subtract 1) . fromEnum
-    enumFrom x             = map toEnum [fromEnum x ..]
-    enumFromThen x y       = map toEnum [fromEnum x, fromEnum y ..]
-    enumFromTo x y         = map toEnum [fromEnum x .. fromEnum y]
+    {-# INLINE succ #-}
+    succ = toEnum . (+ 1) . fromEnum
+
+    {-# INLINE pred #-}
+    pred = toEnum . (subtract 1) . fromEnum
+
+    {-# INLINE enumFrom #-}
+    enumFrom x = map toEnum [fromEnum x ..]
+
+    {-# INLINE enumFromThen #-}
+    enumFromThen x y = map toEnum [fromEnum x, fromEnum y ..]
+
+    {-# INLINE enumFromTo #-}
+    enumFromTo x y = map toEnum [fromEnum x .. fromEnum y]
+
+    {-# INLINE enumFromThenTo #-}
     enumFromThenTo x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y]
 
 -- Default methods for bounded enumerations



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/951b8eda5a1326415a5ef5db23f00e16f70fccab

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/951b8eda5a1326415a5ef5db23f00e16f70fccab
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200511/faee8477/attachment-0001.html>


More information about the ghc-commits mailing list