Repository navigation
Implement iforM and iforM_ (#262) - #311
Conversation
|
LGTM Also I vaguely remember that GHC required fully saturated application to inline. So |
|
Right, I copypasted the definition of |
Sorry. I take that back. :) You forgot |
|
Good catch! |
|
Amended PR LGTM. @lehins @Bodigrim could any of you take a look it just in case. I already almost missed Primitive reexport No it seems GHC is good with current definition. Toy benchmark sees no difference: import qualified Data.Vector as V
import Criterion.Main
fun1 :: (Int -> IO ()) -> IO ()
{-# NOINLINE fun1 #-}
fun1 = V.forM_ (V.generate 4000 id)
fun2 :: (Int -> IO ()) -> IO ()
{-# NOINLINE fun2 #-}
fun2 = \f -> V.forM_ (V.generate 4000 id) f
main :: IO ()
main = defaultMain
[ bench "1" $ whnfIO (fun1 (\i -> return ()))
, bench "2" $ whnfIO (fun2 (\i -> return ()))
]-O0-O |
Bodigrim
left a comment
There was a problem hiding this comment.
Great stuff! Sorry for succumbing to unholy nitpicking.
|
Looks great. All comments are addressed. @fumieval Thank you! |
|
Thank you guys too for swift feedbacks! |
Added iforM and iforM_, indexed variants of
forMandforM_