@@ -497,6 +497,10 @@ or value = S.or . S.map (> (value + 1))
497find :: Monad m => Int -> SerialT m Int -> m (Maybe Int)
497find :: Monad m => Int -> SerialT m Int -> m (Maybe Int)
498find value = S.find (== (value + 1))
498find value = S.find (== (value + 1))
501+findM :: Monad m => Int -> SerialT m Int -> m (Maybe Int)
502+findM value = S.findM (\z -> return $ z == (value + 1))
500{-# INLINE findIndex #-}
504{-# INLINE findIndex #-}
501findIndex :: Monad m => Int -> SerialT m Int -> m (Maybe Int)
505findIndex :: Monad m => Int -> SerialT m Int -> m (Maybe Int)
502findIndex value = S.findIndex (== (value + 1))
506findIndex value = S.findIndex (== (value + 1))
@@ -606,6 +610,7 @@ o_1_space_elimination_folds value =
607 , bench "the" $ nfIO $ randomRIO (1,1) >>= the . repeat value
611 , bench "the" $ nfIO $ randomRIO (1,1) >>= the . repeat value
608 , benchIOSink value "find" (find value)
612 , benchIOSink value "find" (find value)
613+ , benchIOSink value "findM" (findM value)
609 -- , benchIOSink value "lookupFirst" (lookup 1)
614 -- , benchIOSink value "lookupFirst" (lookup 1)
610 , benchIOSink value "lookupNever" (lookup (value + 1))
615 , benchIOSink value "lookupNever" (lookup (value + 1))
611 , benchIOSink value "(!!)" ((!!) value)
616 , benchIOSink value "(!!)" ((!!) value)
@@ -867,6 +872,10 @@ scanlM' n = composeN n $ S.scanlM' (\b a -> return $ b + a) (return 0)
867scanl1' :: MonadIO m => Int -> SerialT m Int -> m ()
872scanl1' :: MonadIO m => Int -> SerialT m Int -> m ()
868scanl1' n = composeN n $ S.scanl1' (+)
873scanl1' n = composeN n $ S.scanl1' (+)
875+{-# INLINE scanl1M' #-}
876+scanl1M' :: MonadIO m => Int -> SerialT m Int -> m ()
877+scanl1M' n = composeN n $ S.scanl1M' (\b a -> return $ b + a)
870{-# INLINE postscanl' #-}
879{-# INLINE postscanl' #-}
871postscanl' :: MonadIO m => Int -> SerialT m Int -> m ()
880postscanl' :: MonadIO m => Int -> SerialT m Int -> m ()
872postscanl' n = composeN n $ S.postscanl' (+) 0
881postscanl' n = composeN n $ S.postscanl' (+) 0
@@ -952,6 +961,7 @@ o_1_space_mapping value =
952 , benchIOSink value "scanl'" (scanl' 1)
961 , benchIOSink value "scanl'" (scanl' 1)
953 , benchIOSink value "scanl1'" (scanl1' 1)
962 , benchIOSink value "scanl1'" (scanl1' 1)
954 , benchIOSink value "scanlM'" (scanlM' 1)
963 , benchIOSink value "scanlM'" (scanlM' 1)
964+ , benchIOSink value "scanl1M'" (scanl1M' 1)
955 , benchIOSink value "postscanl'" (postscanl' 1)
965 , benchIOSink value "postscanl'" (postscanl' 1)
956 , benchIOSink value "postscanlM'" (postscanlM' 1)
966 , benchIOSink value "postscanlM'" (postscanlM' 1)
@@ -968,6 +978,7 @@ o_1_space_mappingX4 value =
968 , benchIOSink value "scanl'" (scanl' 4)
978 , benchIOSink value "scanl'" (scanl' 4)
969 , benchIOSink value "scanl1'" (scanl1' 4)
979 , benchIOSink value "scanl1'" (scanl1' 4)
970 , benchIOSink value "scanlM'" (scanlM' 4)
980 , benchIOSink value "scanlM'" (scanlM' 4)
981+ , benchIOSink value "scanl1M'" (scanl1M' 4)
971 , benchIOSink value "postscanl'" (postscanl' 4)
982 , benchIOSink value "postscanl'" (postscanl' 4)
972 , benchIOSink value "postscanlM'" (postscanlM' 4)
983 , benchIOSink value "postscanlM'" (postscanlM' 4)
@@ -1752,6 +1763,13 @@ concatMap outer inner n =
1752 (\_ -> sourceUnfoldrM inner n)
1763 (\_ -> sourceUnfoldrM inner n)
1753 (sourceUnfoldrM outer n)
1764 (sourceUnfoldrM outer n)
1766+{-# INLINE concatMapM #-}
1767+concatMapM :: Int -> Int -> Int -> IO ()
1768+concatMapM outer inner n =
1769+ S.drain $ S.concatMapM
1770+ (\_ -> return $ sourceUnfoldrM inner n)
1771+ (sourceUnfoldrM outer n)
1755#ifdef INSPECTION
1773#ifdef INSPECTION
1756inspect $ hasNoTypeClasses 'concatMap
1774inspect $ hasNoTypeClasses 'concatMap
1757inspect $ 'concatMap `hasNoType` ''SPEC
1775inspect $ 'concatMap `hasNoType` ''SPEC
@@ -1842,6 +1860,13 @@ o_1_space_concat value = sqrtVal `seq`
1842 , benchIOSrc1 "concatMap (1 of n)"
1860 , benchIOSrc1 "concatMap (1 of n)"
1843 (concatMap 1 value)
1861 (concatMap 1 value)
1863+ , benchIOSrc1 "concatMapM (n of 1)"
1864+ (concatMapM value 1)
1865+ , benchIOSrc1 "concatMapM (sqrt n of sqrt n)"
1866+ (concatMapM sqrtVal sqrtVal)
1867+ , benchIOSrc1 "concatMapM (1 of n)"
1868+ (concatMapM 1 value)
1845 -- This is for comparison with foldMapWith
1870 -- This is for comparison with foldMapWith
1846 , benchIOSrc serially "concatMapWithId (n of 1) (fromFoldable)"
1871 , benchIOSrc serially "concatMapWithId (n of 1) (fromFoldable)"
1847 (S.concatMapWith serial id . sourceConcatMapId value)
1872 (S.concatMapWith serial id . sourceConcatMapId value)