Skip to content

Data.List.cycle is not a good producer

Data.List.cycle is not a good producer. I believe the following fixes it. The tests I've profiled so far suggest it does so.

{-# INLINE cycle #-}
cycle :: [a] -> [a]
cycle [] = error "Empty cycle."
cycle xs = let cyc = augment cycle' cyc in cyc
  where cycle' c n = foldr c n xs 
Edited by David Feuer
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information