diff --git a/Control/Seq.hs b/Control/Seq.hs index 13211ff..1fdf7bb 100644 --- a/Control/Seq.hs +++ b/Control/Seq.hs @@ -39,6 +39,7 @@ module Control.Seq -- * Sequential strategies for foldable data types , seqFoldable -- :: Foldable t => Strategy a -> Strategy (t a) + , seqBifoldable -- :: Bifoldable p => Strategy a -> Strategy b -> Strategy (p a b) , seqMap -- :: Strategy k -> Strategy v -> Strategy (Map k v) , seqArray -- :: Ix i => Strategy a -> Strategy (Array i a) , seqArrayBounds -- :: Ix i => Strategy i -> Strategy (Array i a) @@ -64,6 +65,7 @@ import Data.Foldable (toList) #else import Data.Foldable (Foldable, toList) #endif +import Data.Bifoldable (Bifoldable (bifoldMap)) import Data.Map (Map) import qualified Data.Map (toList) #if !((__GLASGOW_HASKELL__ >= 711) && MIN_VERSION_array(0,5,1)) @@ -146,6 +148,11 @@ seqFoldable strat = seqList strat . toList {-# SPECIALISE seqFoldable :: Strategy a -> Strategy [a] #-} +-- | Evaluate the elements of a bifoldable data structure according to +-- the given strategy +seqBifoldable :: Bifoldable p => Strategy a -> Strategy b -> Strategy (p a b) +seqBifoldable = bifoldMap + -- | Evaluate the elements of an array according to the given strategy. -- Evaluation of the array bounds may be triggered as a side effect. #if (__GLASGOW_HASKELL__ >= 711) && MIN_VERSION_array(0,5,1) diff --git a/parallel.cabal b/parallel.cabal index d20d5b1..756cdf8 100644 --- a/parallel.cabal +++ b/parallel.cabal @@ -44,6 +44,7 @@ library build-depends: array >= 0.3 && < 0.6, base >= 4.3 && < 4.17, + bifunctor , containers >= 0.4 && < 0.7, deepseq >= 1.1 && < 1.5