summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/ST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/ST.hs')
-rw-r--r--lib/Data/Packed/ST.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs
index 48e35b4..652f43e 100644
--- a/lib/Data/Packed/ST.hs
+++ b/lib/Data/Packed/ST.hs
@@ -90,11 +90,11 @@ writeVector :: Storable t => STVector s t -> Int -> t -> ST s ()
90writeVector = safeIndexV unsafeWriteVector 90writeVector = safeIndexV unsafeWriteVector
91 91
92{-# NOINLINE newUndefinedVector #-} 92{-# NOINLINE newUndefinedVector #-}
93newUndefinedVector :: Element t => Int -> ST s (STVector s t) 93newUndefinedVector :: Storable t => Int -> ST s (STVector s t)
94newUndefinedVector = unsafeIOToST . fmap STVector . createVector 94newUndefinedVector = unsafeIOToST . fmap STVector . createVector
95 95
96{-# INLINE newVector #-} 96{-# INLINE newVector #-}
97newVector :: Element t => t -> Int -> ST s (STVector s t) 97newVector :: Storable t => t -> Int -> ST s (STVector s t)
98newVector x n = do 98newVector x n = do
99 v <- newUndefinedVector n 99 v <- newUndefinedVector n
100 let go (-1) = return v 100 let go (-1) = return v
@@ -164,9 +164,9 @@ writeMatrix :: Storable t => STMatrix s t -> Int -> Int -> t -> ST s ()
164writeMatrix = safeIndexM unsafeWriteMatrix 164writeMatrix = safeIndexM unsafeWriteMatrix
165 165
166{-# NOINLINE newUndefinedMatrix #-} 166{-# NOINLINE newUndefinedMatrix #-}
167newUndefinedMatrix :: Element t => MatrixOrder -> Int -> Int -> ST s (STMatrix s t) 167newUndefinedMatrix :: Storable t => MatrixOrder -> Int -> Int -> ST s (STMatrix s t)
168newUndefinedMatrix order r c = unsafeIOToST $ fmap STMatrix $ createMatrix order r c 168newUndefinedMatrix order r c = unsafeIOToST $ fmap STMatrix $ createMatrix order r c
169 169
170{-# NOINLINE newMatrix #-} 170{-# NOINLINE newMatrix #-}
171newMatrix :: Element t => t -> Int -> Int -> ST s (STMatrix s t) 171newMatrix :: Storable t => t -> Int -> Int -> ST s (STMatrix s t)
172newMatrix v r c = unsafeThawMatrix $ reshape c $ runSTVector $ newVector v (r*c) 172newMatrix v r c = unsafeThawMatrix $ reshape c $ runSTVector $ newVector v (r*c)