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.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs
index ed0a05e..91b7968 100644
--- a/lib/Data/Packed/ST.hs
+++ b/lib/Data/Packed/ST.hs
@@ -30,9 +30,7 @@ module Data.Packed.ST (
30) where 30) where
31 31
32import Data.Packed.Internal 32import Data.Packed.Internal
33import Data.Array.Storable
34import Control.Monad.ST 33import Control.Monad.ST
35import Data.Array.ST
36import Foreign 34import Foreign
37 35
38{-# INLINE ioReadV #-} 36{-# INLINE ioReadV #-}
@@ -97,13 +95,13 @@ newVector v = unsafeThawVector . constant v
97 95
98{-# INLINE ioReadM #-} 96{-# INLINE ioReadM #-}
99ioReadM :: Storable t => Matrix t -> Int -> Int -> IO t 97ioReadM :: Storable t => Matrix t -> Int -> Int -> IO t
100ioReadM (MC nr nc cv) r c = ioReadV cv (r*nc+c) 98ioReadM (MC _ nc cv) r c = ioReadV cv (r*nc+c)
101ioReadM (MF nr nc fv) r c = ioReadV fv (c*nr+r) 99ioReadM (MF nr _ fv) r c = ioReadV fv (c*nr+r)
102 100
103{-# INLINE ioWriteM #-} 101{-# INLINE ioWriteM #-}
104ioWriteM :: Storable t => Matrix t -> Int -> Int -> t -> IO () 102ioWriteM :: Storable t => Matrix t -> Int -> Int -> t -> IO ()
105ioWriteM (MC nr nc cv) r c val = ioWriteV cv (r*nc+c) val 103ioWriteM (MC _ nc cv) r c val = ioWriteV cv (r*nc+c) val
106ioWriteM (MF nr nc fv) r c val = ioWriteV fv (c*nr+r) val 104ioWriteM (MF nr _ fv) r c val = ioWriteV fv (c*nr+r) val
107 105
108newtype STMatrix s t = STMatrix (Matrix t) 106newtype STMatrix s t = STMatrix (Matrix t)
109 107