Commits

Aleksey Khudyakov committed 71d9a4d

Add minimal Foldable instance for Contvec

Comments (0)

Files changed (1)

Data/Vector/Fixed/Cont.hs

 
 import Control.Applicative (Applicative(..),(<$>))
 import Data.Complex        (Complex(..))
+import qualified Data.Foldable as F
+
 import Data.Vector.Fixed.Internal.Arity
 import Data.Vector.Fixed.Internal.Id
 import Prelude hiding ( replicate,map,zipWith,maximum,minimum,and,or,any,all
   {-# INLINE pure  #-}
   {-# INLINE (<*>) #-}
 
+instance (Arity n) => F.Foldable (ContVecT Id n) where
+  foldr f z = runContVec (foldr f z)
+  {-# INLINE foldr #-}
+
 -- | Change monad type for the continuation vector.
 changeMonad :: (Monad p, Arity n)
             => (forall x. p x -> x) -- ^ Function to extract result from monad