summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/monadic.hs (renamed from monadic.hs)0
-rw-r--r--lib/Data/Packed/Internal/Vector.hs2
-rw-r--r--lib/Data/Packed/Vector.hs3
3 files changed, 4 insertions, 1 deletions
diff --git a/monadic.hs b/examples/monadic.hs
index b933de9..b933de9 100644
--- a/monadic.hs
+++ b/examples/monadic.hs
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