diff options
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 2 | ||||
-rw-r--r-- | lib/Data/Packed/Vector.hs | 3 |
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 | ||
390 | mapVectorM :: (Storable a, Storable b, Monad m) => (a -> m b) -> Vector a -> m (Vector b) | 391 | mapVectorM :: (Storable a, Storable b, Monad m) => (a -> m b) -> Vector a -> m (Vector b) |
391 | mapVectorM f v = do | 392 | mapVectorM 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 | ||
422 | mapVectorWithIndexM :: (Storable a, Storable b, Monad m) => (Int -> a -> m b) -> Vector a -> m (Vector b) | 424 | mapVectorWithIndexM :: (Storable a, Storable b, Monad m) => (Int -> a -> m b) -> Vector a -> m (Vector b) |
423 | mapVectorWithIndexM f v = do | 425 | mapVectorWithIndexM 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 () | |||
99 | state_put s = State $ \_ -> ((),s) | 99 | state_put s = State $ \_ -> ((),s) |
100 | 100 | ||
101 | evalState :: State s a -> s -> a | 101 | evalState :: State s a -> s -> a |
102 | evalState m s = fst $ runState m s | 102 | evalState m s = let (a,s') = runState m s |
103 | in seq s' a | ||
103 | 104 | ||
104 | newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) } | 105 | newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) } |
105 | 106 | ||