Skip to content

Commit 2dd6741

Browse files
authored
Remove dead comments (#414)
Remove dead comments and add versioning key to caching on CI: * Type class is defined in D.V.Generic.Base No reason to keep its commented out code * Fix error message * Remove obsolete comment When offending function (Data.Vector.Unboxed.unstream . Bundle.fromList) is compiled it produces rather straightforward core. It seems GHC fixed problem whatever it was. * There's another dead comment * Change key for GA cache CI jobs fail with weird error: > vector-doctest: /usr/local/.ghcup/ghc/8.6.5/bin/ghc-8.6.5: > getPermissions:getFileStatus: does not exist (No such file or directory) Let try to change cache key in order to avoid using possibly broken cache
1 parent c195e2c commit 2dd6741

3 files changed

Lines changed: 2 additions & 150 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
name: Cache ~/.cabal/store
5858
with:
5959
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
60-
key: ${{ runner.os }}-${{ matrix.ghc }}--${{ github.Shah }}
60+
key: ${{ runner.os }}-${{ matrix.ghc }}--${{ github.Shah }}-CACHE_V2
6161
# ----------------
6262
- name: Versions
6363
run: |

vector/src/Data/Vector/Generic/Mutable.hs

Lines changed: 0 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -92,134 +92,6 @@ import Prelude hiding ( length, null, replicate, reverse, map, read,
9292

9393
#include "vector.h"
9494

95-
{-
96-
type family Immutable (v :: * -> * -> *) :: * -> *
97-
98-
-- | Class of mutable vectors parameterised with a primitive state token.
99-
--
100-
class MBundle.Pointer u a => MVector v a where
101-
-- | Length of the mutable vector. This method should not be
102-
-- called directly, use 'length' instead.
103-
basicLength :: v s a -> Int
104-
105-
-- | Yield a part of the mutable vector without copying it. This method
106-
-- should not be called directly, use 'unsafeSlice' instead.
107-
basicUnsafeSlice :: Int -- ^ starting index
108-
-> Int -- ^ length of the slice
109-
-> v s a
110-
-> v s a
111-
112-
-- Check whether two vectors overlap. This method should not be
113-
-- called directly, use 'overlaps' instead.
114-
basicOverlaps :: v s a -> v s a -> Bool
115-
116-
-- | Create a mutable vector of the given length. This method should not be
117-
-- called directly, use 'unsafeNew' instead.
118-
basicUnsafeNew :: PrimMonad m => Int -> m (v (PrimState m) a)
119-
120-
-- | Create a mutable vector of the given length and fill it with an
121-
-- initial value. This method should not be called directly, use
122-
-- 'replicate' instead.
123-
basicUnsafeReplicate :: PrimMonad m => Int -> a -> m (v (PrimState m) a)
124-
125-
-- | Yield the element at the given position. This method should not be
126-
-- called directly, use 'unsafeRead' instead.
127-
basicUnsafeRead :: PrimMonad m => v (PrimState m) a -> Int -> m a
128-
129-
-- | Replace the element at the given position. This method should not be
130-
-- called directly, use 'unsafeWrite' instead.
131-
basicUnsafeWrite :: PrimMonad m => v (PrimState m) a -> Int -> a -> m ()
132-
133-
-- | Reset all elements of the vector to some undefined value, clearing all
134-
-- references to external objects. This is usually a noop for unboxed
135-
-- vectors. This method should not be called directly, use 'clear' instead.
136-
basicClear :: PrimMonad m => v (PrimState m) a -> m ()
137-
138-
-- | Set all elements of the vector to the given value. This method should
139-
-- not be called directly, use 'set' instead.
140-
basicSet :: PrimMonad m => v (PrimState m) a -> a -> m ()
141-
142-
basicUnsafeCopyPointer :: PrimMonad m => v (PrimState m) a
143-
-> Immutable v a
144-
-> m ()
145-
146-
-- | Copy a vector. The two vectors may not overlap. This method should not
147-
-- be called directly, use 'unsafeCopy' instead.
148-
basicUnsafeCopy :: PrimMonad m => v (PrimState m) a -- ^ target
149-
-> v (PrimState m) a -- ^ source
150-
-> m ()
151-
152-
-- | Move the contents of a vector. The two vectors may overlap. This method
153-
-- should not be called directly, use 'unsafeMove' instead.
154-
basicUnsafeMove :: PrimMonad m => v (PrimState m) a -- ^ target
155-
-> v (PrimState m) a -- ^ source
156-
-> m ()
157-
158-
-- | Grow a vector by the given number of elements. This method should not be
159-
-- called directly, use 'unsafeGrow' instead.
160-
basicUnsafeGrow :: PrimMonad m => v (PrimState m) a -> Int
161-
-> m (v (PrimState m) a)
162-
163-
{-# INLINE basicUnsafeReplicate #-}
164-
basicUnsafeReplicate n x
165-
= do
166-
v <- basicUnsafeNew n
167-
basicSet v x
168-
return v
169-
170-
{-# INLINE basicClear #-}
171-
basicClear _ = return ()
172-
173-
{-# INLINE basicSet #-}
174-
basicSet !v x
175-
| n == 0 = return ()
176-
| otherwise = do
177-
basicUnsafeWrite v 0 x
178-
do_set 1
179-
where
180-
!n = basicLength v
181-
182-
do_set i | 2*i < n = do basicUnsafeCopy (basicUnsafeSlice i i v)
183-
(basicUnsafeSlice 0 i v)
184-
do_set (2*i)
185-
| otherwise = basicUnsafeCopy (basicUnsafeSlice i (n-i) v)
186-
(basicUnsafeSlice 0 (n-i) v)
187-
188-
{-# INLINE basicUnsafeCopyPointer #-}
189-
basicUnsafeCopyPointer !dst !src = do_copy 0 src
190-
where
191-
do_copy !i p | Just (x,q) <- MBundle.pget p = do
192-
basicUnsafeWrite dst i x
193-
do_copy (i+1) q
194-
| otherwise = return ()
195-
196-
{-# INLINE basicUnsafeCopy #-}
197-
basicUnsafeCopy !dst !src = do_copy 0
198-
where
199-
!n = basicLength src
200-
201-
do_copy i | i < n = do
202-
x <- basicUnsafeRead src i
203-
basicUnsafeWrite dst i x
204-
do_copy (i+1)
205-
| otherwise = return ()
206-
207-
{-# INLINE basicUnsafeMove #-}
208-
basicUnsafeMove !dst !src
209-
| basicOverlaps dst src = do
210-
srcCopy <- clone src
211-
basicUnsafeCopy dst srcCopy
212-
| otherwise = basicUnsafeCopy dst src
213-
214-
{-# INLINE basicUnsafeGrow #-}
215-
basicUnsafeGrow v by
216-
= do
217-
v' <- basicUnsafeNew (n+by)
218-
basicUnsafeCopy (basicUnsafeSlice 0 n v') v
219-
return v'
220-
where
221-
n = basicLength v
222-
-}
22395

22496
-- ------------------
22597
-- Internal functions
@@ -338,16 +210,6 @@ munstream s = case upperBound (MBundle.size s) of
338210
Just n -> munstreamMax s n
339211
Nothing -> munstreamUnknown s
340212

341-
-- FIXME: I can't think of how to prevent GHC from floating out
342-
-- unstreamUnknown. That is bad because SpecConstr then generates two
343-
-- specialisations: one for when it is called from unstream (it doesn't know
344-
-- the shape of the vector) and one for when the vector has grown. To see the
345-
-- problem simply compile this:
346-
--
347-
-- fromList = Data.Vector.Unboxed.unstream . Bundle.fromList
348-
--
349-
-- I'm not sure this still applies (19/04/2010)
350-
351213
munstreamMax :: (PrimMonad m, MVector v a)
352214
=> MBundle m u a -> Int -> m (v (PrimState m) a)
353215
{-# INLINE munstreamMax #-}
@@ -396,16 +258,6 @@ vmunstream s = case upperBound (MBundle.size s) of
396258
Just n -> vmunstreamMax s n
397259
Nothing -> vmunstreamUnknown s
398260

399-
-- FIXME: I can't think of how to prevent GHC from floating out
400-
-- unstreamUnknown. That is bad because SpecConstr then generates two
401-
-- specialisations: one for when it is called from unstream (it doesn't know
402-
-- the shape of the vector) and one for when the vector has grown. To see the
403-
-- problem simply compile this:
404-
--
405-
-- fromList = Data.Vector.Unboxed.unstream . Bundle.fromList
406-
--
407-
-- I'm not sure this still applies (19/04/2010)
408-
409261
vmunstreamMax :: (PrimMonad m, V.Vector v a)
410262
=> MBundle m v a -> Int -> m (V.Mutable v (PrimState m) a)
411263
{-# INLINE vmunstreamMax #-}

vector/src/Data/Vector/Primitive/Mutable.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ instance Prim a => G.MVector MVector a where
134134
{-# INLINE basicUnsafeNew #-}
135135
basicUnsafeNew n
136136
| n < 0 = error $ "Primitive.basicUnsafeNew: negative length: " ++ show n
137-
| n > mx = error $ "Primitive.basicUnsafeNew: length to large: " ++ show n
137+
| n > mx = error $ "Primitive.basicUnsafeNew: length too large: " ++ show n
138138
| otherwise = MVector 0 n `liftM` newByteArray (n * size)
139139
where
140140
size = sizeOf (undefined :: a)

0 commit comments

Comments
 (0)