{-# LANGUAGE CPP #-} #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif #include "containers.h" {-# OPTIONS_HADDOCK hide #-} -- = WARNING -- -- This module is considered __internal__. -- -- The Package Versioning Policy __does not apply__. -- -- This contents of this module may change __in any way whatsoever__ -- and __without any warning__ between minor versions of this package. -- -- Authors importing this module are expected to track development -- closely. module Data.Utils.StrictFold (foldlStrict) where -- | Same as regular 'Data.List.foldl'', but marked INLINE so that it is always -- inlined. This allows further optimization of the call to f, which can be -- optimized/specialised/inlined. foldlStrict :: (a -> b -> a) -> a -> [b] -> a foldlStrict f = go where go z [] = z go z (x:xs) = let z' = f z x in z' `seq` go z' xs {-# INLINE foldlStrict #-}