diff options
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 "----------------------" |