diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-06-27 17:24:37 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-06-27 17:24:37 +0000 |
commit | deb17122b5804d04b06cc830f5aa121e739eaf21 (patch) | |
tree | 75834f13b68273faee07d86d2e3d5a3d965fddc5 /examples/inplace.hs | |
parent | fe795ee9b1e71666d408879ce30fe6d4ca80830e (diff) |
tested with ghc-6.8.3
Diffstat (limited to 'examples/inplace.hs')
-rw-r--r-- | examples/inplace.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/inplace.hs b/examples/inplace.hs index 9f23e0c..dcfff56 100644 --- a/examples/inplace.hs +++ b/examples/inplace.hs | |||
@@ -129,6 +129,14 @@ histoCheck ds = runSTVector $ do | |||
129 | mapM_ inc ds | 129 | mapM_ inc ds |
130 | return h | 130 | return h |
131 | 131 | ||
132 | hc = fromList [1 .. 15::Double] | ||
133 | |||
134 | -- check that thawVector creates a new array | ||
135 | histoCheck2 ds = runSTVector $ do | ||
136 | h <- thawVector hc | ||
137 | let inc k = modifyVector h k (+1) | ||
138 | mapM_ inc ds | ||
139 | return h | ||
132 | 140 | ||
133 | test8 = do | 141 | test8 = do |
134 | let ds = [0..14] | 142 | let ds = [0..14] |
@@ -138,4 +146,7 @@ test8 = do | |||
138 | print $ histoCheck ds | 146 | print $ histoCheck ds |
139 | print $ histoCheck ds | 147 | print $ histoCheck ds |
140 | print $ histoCheck ds | 148 | print $ histoCheck ds |
149 | print $ histoCheck2 ds | ||
150 | print $ histoCheck2 ds | ||
151 | print $ histoCheck2 ds | ||
141 | putStrLn "----------------------" | 152 | putStrLn "----------------------" |