packages feed

fixed-vector 0.8.0.0 → 0.8.1.0

raw patch · 6 files changed

+28/−4 lines, 6 filesdep ~doctestPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: doctest

API changes (from Hackage documentation)

+ Data.Vector.Fixed: find :: Vector v a => (a -> Bool) -> v a -> Maybe a
+ Data.Vector.Fixed.Cont: find :: Arity n => (a -> Bool) -> ContVec n a -> Maybe a
+ Data.Vector.Fixed.Monomorphic: find :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> Maybe a

Files

ChangeLog view
@@ -1,3 +1,8 @@+Changes in 0.8.1.0++  * `find` function added.++ Changes in 0.8.0.0    * NFData instances for all data type.
Data/Vector/Fixed.hs view
@@ -129,6 +129,7 @@   , or   , all   , any+  , find     -- * Zips   , zipWith   , zipWith3
Data/Vector/Fixed/Cont.hs view
@@ -135,12 +135,13 @@   , or   , all   , any+  , find     -- ** Data.Data.Data   , gfoldl   , gunfold   ) where -import Control.Applicative (Applicative(..),(<$>))+import Control.Applicative (Applicative(..),(<$>),(<|>)) import Control.Monad       (liftM) import Data.Complex        (Complex(..)) import Data.Data           (Typeable,Data)@@ -1154,6 +1155,13 @@ any :: Arity n => (a -> Bool) -> ContVec n a -> Bool any f = foldr (\x b -> f x && b) True {-# INLINE any #-}++-- | The 'find' function takes a predicate and a vector and returns+--   the leftmost element of the vector matching the predicate,+--   or 'Nothing' if there is no such element.+find :: Arity n => (a -> Bool) -> ContVec n a -> Maybe a+find f = foldl (\r x -> r <|> if f x then Just x else Nothing) Nothing+{-# INLINE find #-}  -- | Generic 'Data.Data.gfoldl' which could work with any vector. gfoldl :: forall c v a. (Vector v a, Data a)
Data/Vector/Fixed/Internal.hs view
@@ -373,6 +373,12 @@ any f = (C.any f) . C.cvec {-# INLINE any #-} +-- | The 'find' function takes a predicate and a vector and returns+--   the leftmost element of the vector matching the predicate,+--   or 'Nothing' if there is no such element.+find :: (Vector v a) => (a -> Bool) -> v a -> Maybe a+find f = (C.find f) . C.cvec+{-# INLINE find #-}  ---------------------------------------------------------------- 
Data/Vector/Fixed/Monomorphic.hs view
@@ -83,6 +83,7 @@   , or   , all   , any+  , find     -- * Zips   , zipWith   , zipWithM@@ -98,7 +99,7 @@ import Data.Monoid   (Monoid) import qualified Data.Vector.Fixed as F import Data.Vector.Fixed.Cont (S,Z,Arity,Fun(..))-import Prelude (Num,Eq,Ord,Functor(..),Monad(..),Int,Bool,(.),($))+import Prelude (Num,Eq,Ord,Functor(..),Monad(..),Int,Bool,(.),($),Maybe)   @@ -295,6 +296,9 @@ any f = F.any f . Mono {-# INLINE any #-} +find :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> Maybe a+find f = F.find f . Mono+{-# INLINE find #-}  ---------------------------------------------------------------- 
fixed-vector.cabal view
@@ -1,5 +1,5 @@ Name:           fixed-vector-Version:        0.8.0.0+Version:        0.8.1.0 Synopsis:       Generic vectors with statically known size. Description:   Generic library for vectors with statically known@@ -92,5 +92,5 @@     base >=3 && <5,     primitive,     -- Additional test dependencies.-    doctest   == 0.9.*,+    doctest   >= 0.9,     filemanip == 0.3.6.*