summaryrefslogtreecommitdiff
path: root/lib/Data/Packed
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-26 21:03:59 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-26 21:03:59 +0000
commitdbd943b89ff481e0971f86c2271223cfddee7a02 (patch)
tree71ebd9be93fda53ee5d98986bfaaa1620012533b /lib/Data/Packed
parentf2f54ac1d76fc391c0e231b4309ae5c4245cd0f9 (diff)
add note about strictness
Diffstat (limited to 'lib/Data/Packed')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs2
-rw-r--r--lib/Data/Packed/Vector.hs3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index 7360f93..ba68909 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -387,6 +387,7 @@ foldVectorG f s0 v = foldLoop g s0 (dim v)
387------------------------------------------------------------------- 387-------------------------------------------------------------------
388 388
389-- | monadic map over Vectors 389-- | monadic map over Vectors
390-- the monad @m@ must be strict
390mapVectorM :: (Storable a, Storable b, Monad m) => (a -> m b) -> Vector a -> m (Vector b) 391mapVectorM :: (Storable a, Storable b, Monad m) => (a -> m b) -> Vector a -> m (Vector b)
391mapVectorM f v = do 392mapVectorM f v = do
392 w <- return $! unsafePerformIO $! createVector (dim v) 393 w <- return $! unsafePerformIO $! createVector (dim v)
@@ -419,6 +420,7 @@ mapVectorM_ f v = do
419{-# INLINE mapVectorM_ #-} 420{-# INLINE mapVectorM_ #-}
420 421
421-- | monadic map over Vectors with the zero-indexed index passed to the mapping function 422-- | monadic map over Vectors with the zero-indexed index passed to the mapping function
423-- the monad @m@ must be strict
422mapVectorWithIndexM :: (Storable a, Storable b, Monad m) => (Int -> a -> m b) -> Vector a -> m (Vector b) 424mapVectorWithIndexM :: (Storable a, Storable b, Monad m) => (Int -> a -> m b) -> Vector a -> m (Vector b)
423mapVectorWithIndexM f v = do 425mapVectorWithIndexM f v = do
424 w <- return $! unsafePerformIO $! createVector (dim v) 426 w <- return $! unsafePerformIO $! createVector (dim v)
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs
index 23fe37f..e79e237 100644
--- a/lib/Data/Packed/Vector.hs
+++ b/lib/Data/Packed/Vector.hs
@@ -99,7 +99,8 @@ state_put :: s -> State s ()
99state_put s = State $ \_ -> ((),s) 99state_put s = State $ \_ -> ((),s)
100 100
101evalState :: State s a -> s -> a 101evalState :: State s a -> s -> a
102evalState m s = fst $ runState m s 102evalState m s = let (a,s') = runState m s
103 in seq s' a
103 104
104newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) } 105newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) }
105 106