Skip to content

Commit d0dac68

Browse files
authored
Merge pull request #122 from dolio/master
Implement more methods of Foldable where possible.
2 parents 27ac40a + 28489fd commit d0dac68

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Data/Vector.hs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,40 @@ instance Foldable.Foldable Vector where
354354
{-# INLINE foldl1 #-}
355355
foldl1 = foldl1
356356

357+
#if MIN_VERSION_base(4,6,0)
358+
{-# INLINE foldr' #-}
359+
foldr' = foldr'
360+
361+
{-# INLINE foldl' #-}
362+
foldl' = foldl'
363+
#endif
364+
365+
#if MIN_VERSION_base(4,8,0)
366+
{-# INLINE toList #-}
367+
toList = toList
368+
369+
{-# INLINE length #-}
370+
length = length
371+
372+
{-# INLINE null #-}
373+
null = null
374+
375+
{-# INLINE elem #-}
376+
elem = elem
377+
378+
{-# INLINE maximum #-}
379+
maximum = maximum
380+
381+
{-# INLINE minimum #-}
382+
minimum = minimum
383+
384+
{-# INLINE sum #-}
385+
sum = sum
386+
387+
{-# INLINE product #-}
388+
product = product
389+
#endif
390+
357391
instance Traversable.Traversable Vector where
358392
{-# INLINE traverse #-}
359393
traverse f xs = Data.Vector.fromList Applicative.<$> Traversable.traverse f (toList xs)

0 commit comments

Comments
 (0)