packages feed

fixed-vector 0.6.2.0 → 0.6.3.0

raw patch · 5 files changed

+66/−12 lines, 5 files

Files

ChangeLog view
@@ -1,3 +1,8 @@+Changes in 0.6.3.0++  * Left scans added.++ Changes in 0.6.2.0    * `Vec1' type synonym for boxed/unboxed/etc. vectors added.
Data/Vector/Fixed.hs view
@@ -99,6 +99,8 @@   , imap   , imapM   , imapM_+  , scanl+  , scanl1   , sequence   , sequence_   , sequenceA@@ -161,7 +163,7 @@ import Data.Vector.Fixed.Internal  import Prelude hiding ( replicate,map,zipWith,maximum,minimum,and,or,all,any-                      , foldl,foldr,foldl1,length,sum,reverse+                      , foldl,foldr,foldl1,length,sum,reverse,scanl,scanl1                       , head,tail,mapM,mapM_,sequence,sequence_                       ) 
Data/Vector/Fixed/Cont.hs view
@@ -71,6 +71,8 @@   , imapM   , mapM_   , imapM_+  , scanl+  , scanl1   , sequence   , sequence_   , distribute@@ -125,7 +127,7 @@ import qualified Data.Traversable as F  import Prelude hiding ( replicate,map,zipWith,maximum,minimum,and,or,any,all-                      , foldl,foldr,foldl1,length,sum,reverse+                      , foldl,foldr,foldl1,length,sum,reverse,scanl,scanl1                       , head,tail,mapM,mapM_,sequence,sequence_                       ) @@ -653,6 +655,40 @@         (  T_map 0 funB :: T_map b r n)  data T_map a r n = T_map Int (Fn n a r)++-- | Left scan over vector+scanl :: (Arity n) => (b -> a -> b) -> b -> ContVec n a -> ContVec (S n) b+{-# INLINE scanl #-}+scanl f b0 (ContVec cont) = ContVec $+  cont . scanlF f b0++-- | Left scan over vector+scanl1 :: (Arity n) => (a -> a -> a) -> ContVec n a -> ContVec n a+{-# INLINE scanl1 #-}+scanl1 f (ContVec cont) = ContVec $+  cont . scanl1F f++scanlF :: forall n a b r. (Arity n) => (b -> a -> b) -> b -> Fun (S n) b r -> Fun n a r+scanlF f b0 (Fun fun0) = Fun+  $ accum step fini start+  where+    step  :: forall k. T_scanl r b (S k) -> a -> T_scanl r b k+    step (T_scanl b fn) a = let b' = f b a in T_scanl b' (fn b')+    fini (T_scanl _ r) = r+    start = T_scanl b0 (fun0 b0)  :: T_scanl r b n++scanl1F :: forall n a r. (Arity n) => (a -> a -> a) -> Fun n a r -> Fun n a r+scanl1F f (Fun fun0) = Fun $ accum step fini start+  where+    step  :: forall k. T_scanl1 r a (S k) -> a -> T_scanl1 r a k+    step (T_scanl1 Nothing  fn) a = T_scanl1 (Just a) (fn a)+    step (T_scanl1 (Just x) fn) a = let a' = f x a in T_scanl1 (Just a') (fn a')+    fini (T_scanl1 _ r) = r+    start = T_scanl1 Nothing fun0 :: T_scanl1 r a n++data T_scanl  r a n = T_scanl a (Fn n a r)+data T_scanl1 r a n = T_scanl1 (Maybe a) (Fn n a r)+  -- | Evaluate every action in the vector from left to right. sequence :: (Arity n, Monad m) => ContVec n (m a) -> m (ContVec n a)
Data/Vector/Fixed/Internal.hs view
@@ -18,7 +18,7 @@ import qualified Data.Vector.Fixed.Cont as C import           Data.Vector.Fixed.Cont   (ContVec,Index) import Prelude hiding ( replicate,map,zipWith,maximum,minimum,and,or,all,any-                      , foldl,foldr,foldl1,length,sum,reverse+                      , foldl,foldr,foldl1,length,sum,reverse,scanl,scanl1                       , head,tail,mapM,mapM_,sequence,sequence_                       ) @@ -442,6 +442,17 @@ {-# INLINE imapM_ #-} imapM_ f = ifoldl (\m i a -> m >> f i a >> return ()) (return ()) +-- | Left scan over vector+scanl :: (Vector v a, Vector w b, Dim w ~ S (Dim v))+      => (b -> a -> b) -> b -> v a -> w b+{-# INLINE scanl #-}+scanl f x0 = vector . C.scanl f x0 . C.cvec++-- | Left scan over vector+scanl1 :: (Vector v a)+      => (a -> a -> a) -> v a -> v a+{-# INLINE scanl1 #-}+scanl1 f = vector . C.scanl1 f . C.cvec  -- | Analog of 'T.sequenceA' from 'T.Traversable'. sequenceA :: (Vector v a, Vector v (f a), Applicative f)
fixed-vector.cabal view
@@ -1,5 +1,5 @@ Name:           fixed-vector-Version:        0.6.2.0+Version:        0.6.3.0 Synopsis:       Generic vectors with statically known size. Description:   Generic library for vectors with statically known@@ -19,30 +19,30 @@   .   Library is structured as follows:   .-  [@Data.Vector.Fixed@]+  * Data.Vector.Fixed   Generic API. It's suitable for both ADT-based vector like Complex   and array-based ones.   .-  [@Data.Vector.Fixed.Cont@]+  * Data.Vector.Fixed.Cont   Continuation based vectors. Internally all functions use them.   .-  [@Data.Vector.Fixed.Mutable@]+  * Data.Vector.Fixed.Mutable   Type classes for array-based implementation and API for working with   mutable state.   .-  [@Data.Vector.Fixed.Unboxed@]+  * Data.Vector.Fixed.Unboxed   Unboxed vectors.   .-  [@Data.Vector.Fixed.Boxed@]+  * Data.Vector.Fixed.Boxed   Boxed vector which can hold elements of any type.   .-  [@Data.Vector.Fixed.Storable@]+  * Data.Vector.Fixed.Storable   Unboxed vectors of Storable  types.   .-  [@Data.Vector.Fixed.Primitive@]+  * Data.Vector.Fixed.Primitive   Unboxed vectors based on pritimive package.   .-  [@Data.Vector.Fixed.Monomorphic@]+  * Data.Vector.Fixed.Monomorphic   Wrappers for monomorphic vectors  Cabal-Version:  >= 1.8