| 1 | 1 patch for repository http://code.haskell.org/vector: |
|---|
| 2 | |
|---|
| 3 | Fri Sep 17 08:12:01 CEST 2010 Daniel Peebles <pumpkingod@gmail.com> |
|---|
| 4 | * Specialize replicateM for primitive Monad instances |
|---|
| 5 | |
|---|
| 6 | New patches: |
|---|
| 7 | |
|---|
| 8 | [Specialize replicateM for primitive Monad instances |
|---|
| 9 | Daniel Peebles <pumpkingod@gmail.com>**20100917061201 |
|---|
| 10 | Ignore-this: fd529ef86eea92198138ac42f0f54bf |
|---|
| 11 | ] { |
|---|
| 12 | hunk ./Data/Vector/Generic.hs 598 |
|---|
| 13 | -- | /O(n)/ Execute the monadic action the given number of times and store the |
|---|
| 14 | -- results in a vector. |
|---|
| 15 | replicateM :: (Monad m, Vector v a) => Int -> m a -> m (v a) |
|---|
| 16 | --- FIXME: specialise for ST and IO? |
|---|
| 17 | {-# INLINE replicateM #-} |
|---|
| 18 | replicateM n m = fromListN n `Monad.liftM` Monad.replicateM n m |
|---|
| 19 | |
|---|
| 20 | hunk ./Data/Vector/Generic.hs 601 |
|---|
| 21 | +{-# RULES |
|---|
| 22 | +"replicateM(IO)" forall n (m :: IO a). |
|---|
| 23 | + replicateM n m = replicateMPrim n m |
|---|
| 24 | + |
|---|
| 25 | +"replicateM(ST)" forall n (m :: forall s. ST s a). |
|---|
| 26 | + replicateM n m = replicateMPrim n m |
|---|
| 27 | + #-} |
|---|
| 28 | + |
|---|
| 29 | +-- A more efficient replicateM that doesn't go through lists, for primitive Monads. |
|---|
| 30 | +-- Not exported, as the only way of getting it is through the above rewrite rules. |
|---|
| 31 | +-- From http://haskell.org/haskellwiki/Numeric_Haskell:_A_Vector_Tutorial |
|---|
| 32 | +{-# INLINE replicateMPrim #-} |
|---|
| 33 | +replicateMPrim :: (PrimMonad m, Vector v a) => Int -> m a -> m (v a) |
|---|
| 34 | +replicateMPrim n m = do |
|---|
| 35 | + v <- M.new n |
|---|
| 36 | + fill v 0 |
|---|
| 37 | + unsafeFreeze v |
|---|
| 38 | + where |
|---|
| 39 | + fill v i |
|---|
| 40 | + | i < n = do |
|---|
| 41 | + x <- m |
|---|
| 42 | + M.unsafeWrite v i x |
|---|
| 43 | + fill v (i+1) |
|---|
| 44 | + | otherwise = return () |
|---|
| 45 | + |
|---|
| 46 | -- | Execute the monadic action and freeze the resulting vector. |
|---|
| 47 | -- |
|---|
| 48 | -- @ |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | Context: |
|---|
| 52 | |
|---|
| 53 | [Fix bad bug in ptrToOffset |
|---|
| 54 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100821050043 |
|---|
| 55 | Ignore-this: 79f397bb354deaef91029c0c6a045d5b |
|---|
| 56 | ] |
|---|
| 57 | [Add function for safe indexing |
|---|
| 58 | Khudyakov Alexey <alexey.skladnoy@gmail.com>**20100727212532 |
|---|
| 59 | Ignore-this: b49d0d25d8dc2b38cc3430e990a5ea9f |
|---|
| 60 | ] |
|---|
| 61 | [TAG 0.6.0.2 |
|---|
| 62 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100615030825 |
|---|
| 63 | Ignore-this: eb4bbce255ad4cbdef645655454ed681 |
|---|
| 64 | ] |
|---|
| 65 | [Changelog |
|---|
| 66 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100615030335 |
|---|
| 67 | Ignore-this: de9af15a7972cb436574f2ba962b6c81 |
|---|
| 68 | ] |
|---|
| 69 | [Eta-expand create to work around GHC bug 4120 |
|---|
| 70 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100615030308 |
|---|
| 71 | Ignore-this: 4c3875d889a56217d147b15145e595c7 |
|---|
| 72 | ] |
|---|
| 73 | [Add freeze |
|---|
| 74 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524075434 |
|---|
| 75 | Ignore-this: 288ab46bd96aed8968437b245f22ad8d |
|---|
| 76 | ] |
|---|
| 77 | [Add Mutable.clone |
|---|
| 78 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524075045 |
|---|
| 79 | Ignore-this: f6710074f85671b32d2b2002bcbc1ebb |
|---|
| 80 | ] |
|---|
| 81 | [Fix comments |
|---|
| 82 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524073956 |
|---|
| 83 | Ignore-this: 8935cfcfba5c13e7274954f326e8c630 |
|---|
| 84 | ] |
|---|
| 85 | [Add unsafeThaw |
|---|
| 86 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524072249 |
|---|
| 87 | Ignore-this: 13c1cd3221c95355e35213c285538618 |
|---|
| 88 | ] |
|---|
| 89 | [Add basicUnsafeThaw |
|---|
| 90 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524071700 |
|---|
| 91 | Ignore-this: 790b47cc41ea0df223f9a6b8ef549661 |
|---|
| 92 | ] |
|---|
| 93 | [Require primitive >= 0.3.1 |
|---|
| 94 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524071649 |
|---|
| 95 | Ignore-this: d0328714d4332f81e98d2c6c7688de71 |
|---|
| 96 | ] |
|---|
| 97 | [Comment |
|---|
| 98 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524060303 |
|---|
| 99 | Ignore-this: c8e6612a32b29bad6d6bc486175a2d63 |
|---|
| 100 | ] |
|---|
| 101 | [Rename unsafeFreeze to basicUnsafeFreeze and add unsafeFreeze as a free function |
|---|
| 102 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524055727 |
|---|
| 103 | Ignore-this: 82af49dbedf2fddd4f1b7acc0da41845 |
|---|
| 104 | ] |
|---|
| 105 | [Bump version to 0.7 |
|---|
| 106 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524055716 |
|---|
| 107 | Ignore-this: e9d27d0a283e5ec8a9cbd7f74f40f219 |
|---|
| 108 | ] |
|---|
| 109 | [Improve tridiag benchmark a bit |
|---|
| 110 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524044438 |
|---|
| 111 | Ignore-this: e182a804ebbee6a9c43d96be6bf4d0c5 |
|---|
| 112 | ] |
|---|
| 113 | [Don't actually inspect SPEC, just seq on it |
|---|
| 114 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524044300 |
|---|
| 115 | Ignore-this: dbf0ab999aafdbee3a21f831a7b6751e |
|---|
| 116 | |
|---|
| 117 | This makes the intermediate code much simpler and might improve demand |
|---|
| 118 | analysis. |
|---|
| 119 | ] |
|---|
| 120 | [Compile benchmarks with -fno-method-sharing |
|---|
| 121 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524040909 |
|---|
| 122 | Ignore-this: 24ff9ef3fa83bf3ea1090a7e5e86398d |
|---|
| 123 | ] |
|---|
| 124 | [Avoid last LiberateCase in D.V.Generic |
|---|
| 125 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524040316 |
|---|
| 126 | Ignore-this: 6d5ca63eabc1ac8fa7384d12a648357c |
|---|
| 127 | ] |
|---|
| 128 | [More bangs to avoid LiberateCase |
|---|
| 129 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524034156 |
|---|
| 130 | Ignore-this: 6735856042b634c37223b55207335d3e |
|---|
| 131 | ] |
|---|
| 132 | [Be explicitly strict in vector lengths more often to avoid triggering LiberateCase |
|---|
| 133 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100524032222 |
|---|
| 134 | Ignore-this: d8b58f39e6ee245977c0fa87be23b2c8 |
|---|
| 135 | ] |
|---|
| 136 | [Make D.V.Generic.stream strict in the length of the vector |
|---|
| 137 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100523055128 |
|---|
| 138 | Ignore-this: 40b5ef525577ba879f2abb3a95ef64a5 |
|---|
| 139 | ] |
|---|
| 140 | [Make enumFromTo* strict in the bounds |
|---|
| 141 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100523053844 |
|---|
| 142 | Ignore-this: 3ff8dbe94783127ff0b0b099e49acb7b |
|---|
| 143 | ] |
|---|
| 144 | [Remove thawMany |
|---|
| 145 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100518054931 |
|---|
| 146 | Ignore-this: 1746ab5c8155999850cb07eabc615799 |
|---|
| 147 | ] |
|---|
| 148 | [Add Stream.flatten and use it to implement concat |
|---|
| 149 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100518054842 |
|---|
| 150 | Ignore-this: 1124240c85914fc5059bc0c601ee9eef |
|---|
| 151 | ] |
|---|
| 152 | [Sanitise Mutable exports and reorder code |
|---|
| 153 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505164012 |
|---|
| 154 | Ignore-this: 685ea7d5bd3f77276af3fffd0a40a476 |
|---|
| 155 | ] |
|---|
| 156 | [Delete comment |
|---|
| 157 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505155507 |
|---|
| 158 | Ignore-this: b08ae6a4f9977d1156cb10eea267f3f7 |
|---|
| 159 | ] |
|---|
| 160 | [Add Monoid instances |
|---|
| 161 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505155345 |
|---|
| 162 | Ignore-this: 2ef598c8b8bbe780b3e5f9561ae59d92 |
|---|
| 163 | ] |
|---|
| 164 | [Add convert |
|---|
| 165 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505151407 |
|---|
| 166 | Ignore-this: 9665dd334d44fa5d3ef57ff978c8ded6 |
|---|
| 167 | ] |
|---|
| 168 | [Replace remaining occurences of basicUnsafeNewWith with basicUnsafeReplicate |
|---|
| 169 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505150308 |
|---|
| 170 | Ignore-this: 7129e607fa1e50481f61f378d714f152 |
|---|
| 171 | ] |
|---|
| 172 | [Add Mutable.replicate and deprecate Mutable.n{newWith,unsafeNewWith} |
|---|
| 173 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505144550 |
|---|
| 174 | Ignore-this: 39aa15df1e0bc3bc1380a3a74443c073 |
|---|
| 175 | ] |
|---|
| 176 | [Add concat and make concatMap more efficient |
|---|
| 177 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505141141 |
|---|
| 178 | Ignore-this: a587071dc839b44fa219d7536cb81d9a |
|---|
| 179 | ] |
|---|
| 180 | [Add thaw and thawMany |
|---|
| 181 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505141028 |
|---|
| 182 | Ignore-this: 14d5862d0940d3598554b07ba7652648 |
|---|
| 183 | ] |
|---|
| 184 | [Export Generic.Mutable.unsafe{Take,Drop} |
|---|
| 185 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100505135854 |
|---|
| 186 | Ignore-this: dbbd6e97ae3276cf312c1036a6f32351 |
|---|
| 187 | ] |
|---|
| 188 | [Fusion rules for monadic indexing |
|---|
| 189 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100503031801 |
|---|
| 190 | Ignore-this: 2ed629ca5b44031b3641a5716f88e763 |
|---|
| 191 | ] |
|---|
| 192 | [Rearrange code |
|---|
| 193 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100428015052 |
|---|
| 194 | Ignore-this: 93c3164d2db02de93a2e415960a4d2d7 |
|---|
| 195 | ] |
|---|
| 196 | [Bump version number |
|---|
| 197 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100428015037 |
|---|
| 198 | Ignore-this: 25626073a2bcad8c11c844975000a728 |
|---|
| 199 | ] |
|---|
| 200 | [TAG 0.6.0.1 |
|---|
| 201 | Roman Leshchinskiy <rl@cse.unsw.edu.au>**20100427053224 |
|---|
| 202 | Ignore-this: a04080a48ae45f144f8556bfba1b43ee |
|---|
| 203 | ] |
|---|
| 204 | Patch bundle hash: |
|---|
| 205 | 8077eb40c3f165676c9fd4bc556e15a287b14494 |
|---|