storablevector 0.2.7.2 → 0.2.7.3
raw patch · 5 files changed
+24/−13 lines, 5 filesdep ~transformers
Dependency ranges changed: transformers
Files
- Data/StorableVector.hs +2/−2
- Data/StorableVector/Base.hs +4/−1
- Data/StorableVector/Cursor.hs +15/−5
- Data/StorableVector/Lazy.hs +0/−2
- storablevector.cabal +3/−3
Data/StorableVector.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} -- -- Module : StorableVector -- Copyright : (c) The University of Glasgow 2001,@@ -7,7 +7,7 @@ -- (c) Don Stewart 2005-2006 -- (c) Bjorn Bringert 2006 -- (c) Spencer Janssen 2006--- (c) Henning Thielemann 2008-2010+-- (c) Henning Thielemann 2008-2011 -- -- -- License : BSD-style
Data/StorableVector/Base.hs view
@@ -1,4 +1,7 @@-{-# OPTIONS_GHC -cpp -fglasgow-exts #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE DeriveDataTypeable #-} -- -- Module : Data.StorableVector.Base -- License : BSD-style
Data/StorableVector/Cursor.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE ExistentialQuantification #-} {- | Simulate a list with strict elements by a more efficient array structure. -}@@ -31,15 +31,16 @@ I hope that this is more efficient. With this restriction @s@ cannot be e.g. a function type but this would kill performance anyway.-Functions which need this flexibility may fall back to other data structures+Functions that need this flexibility may fall back to other data structures (lists or chunky StorableVectors) and convert to the Cursor structure later. -} -- | Cf. StreamFusion Data.Stream data Generator a = forall s. -- Seq s => Generator- {-# UNPACK #-} !(StateT s Maybe a) -- compute next value- {-# UNPACK #-} !(IORef (Maybe s)) -- current state+ !(StateT s Maybe a) -- compute next value+ {-# UNPACK #-}+ !(IORef (Maybe s)) -- current state {- | This simulates a@@ -50,7 +51,7 @@ Buffer { memory :: {-# UNPACK #-} !(ForeignPtr a), size :: {-# UNPACK #-} !Int, -- size of allocated memory, I think I only need it for debugging- gen :: {-# UNPACK #-} !(Generator a),+ gen :: !(Generator a), -- we need this indirection for the existential type in Generator cursor :: {-# UNPACK #-} !(IORef Int) } @@ -156,6 +157,9 @@ {-# INLINE cons #-} {- | This is expensive and should not be used to construct lists iteratively!+A recursion-enabling 'cons' would be 'consN'+that allocates a buffer of given size,+initializes the leading cell and sets the buffer pointer to the next cell. -} cons :: Storable a => a -> Vector a -> Vector a@@ -221,6 +225,12 @@ withForeignPtr p (\q -> pokeElemOff q c a) >> return (Just a) +{-+It is tempting to turn this into a simple loop without the IORefs.+This could be compiled to an efficient strict loop,+but it would fail if the vector content depends on its own,+like in @fix (consN 1000 'a')@.+-} -- | evaluate all values up to a given position evaluateToIO :: Storable a => Int -> Buffer a -> IO ()
Data/StorableVector/Lazy.hs view
@@ -1,5 +1,3 @@-{-# OPTIONS_GHC -O2 -fglasgow-exts #-}-{- glasgow-exts are for the rules -} {- | Chunky signal stream build on StorableVector.
storablevector.cabal view
@@ -1,5 +1,5 @@ Name: storablevector-Version: 0.2.7.2+Version: 0.2.7.3 Category: Data Synopsis: Fast, packed, strict storable arrays with a list interface like ByteString Description:@@ -51,13 +51,13 @@ Source-Repository this type: darcs location: http://code.haskell.org/storablevector/- tag: 0.2.7.2+ tag: 0.2.7.3 Library Build-Depends: non-negative >= 0.1 && <0.2, utility-ht >= 0.0.5 && <0.1,- transformers >=0.2 && <0.3,+ transformers >=0.2 && <0.4, QuickCheck >= 1 && < 3 If impl(jhc)