Skip to content

Commit

Permalink
Merge pull request #110 from gilgamec/master
Browse files Browse the repository at this point in the history
Changed indexes provided to accum to type-safe Finites.
  • Loading branch information
expipiplus1 authored Aug 26, 2021
2 parents 45ef035 + eb0e755 commit 764e7a8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## WIP

## [1.5.0] - 2021-08-25

- Change indexes used by `accum` from `Int` to `Finite`.

## [1.4.4] - 2021-06-26

- Add `ix'`
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: vector-sized
version: 1.4.4
version: 1.5.0
synopsis: Size tagged vectors
description: Please see README.md
category: Data
Expand Down
5 changes: 3 additions & 2 deletions src/Data/Vector/Generic/Sized.hs
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,10 @@ unsafeUpdate_ (Vector v) (Vector is) (Vector w) =
accum :: VG.Vector v a
=> (a -> b -> a) -- ^ accumulating function @f@
-> Vector v m a -- ^ initial vector (of length @m@)
-> [(Int,b)] -- ^ list of index/value pairs (of length @n@)
-> [(Finite m,b)] -- ^ list of index/value pairs (of length @n@)
-> Vector v m a
accum f (Vector v) us = Vector (VG.accum f v us)
accum f (Vector v) us =
Vector (VG.accum f v $ (fmap . first) (fromIntegral . getFinite) us)
{-# inline accum #-}

-- | /O(m+n)/ For each pair @(i,b)@ from the vector of pairs, replace the vector
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Vector/Primitive/Sized.hs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ unsafeUpdate_ = V.unsafeUpdate_
accum :: Prim a
=> (a -> b -> a) -- ^ accumulating function @f@
-> Vector m a -- ^ initial vector (of length @m@)
-> [(Int,b)] -- ^ list of index/value pairs (of length @n@)
-> [(Finite m,b)] -- ^ list of index/value pairs (of length @n@)
-> Vector m a
accum = V.accum
{-# inline accum #-}
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Vector/Sized.hs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ unsafeUpdate_ = V.unsafeUpdate_
-- > accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>
accum :: (a -> b -> a) -- ^ accumulating function @f@
-> Vector m a -- ^ initial vector (of length @m@)
-> [(Int,b)] -- ^ list of index/value pairs (of length @n@)
-> [(Finite m,b)] -- ^ list of index/value pairs (of length @n@)
-> Vector m a
accum = V.accum
{-# inline accum #-}
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Vector/Storable/Sized.hs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ unsafeUpdate_ = V.unsafeUpdate_
accum :: Storable a
=> (a -> b -> a) -- ^ accumulating function @f@
-> Vector m a -- ^ initial vector (of length @m@)
-> [(Int,b)] -- ^ list of index/value pairs (of length @n@)
-> [(Finite m,b)] -- ^ list of index/value pairs (of length @n@)
-> Vector m a
accum = V.accum
{-# inline accum #-}
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Vector/Unboxed/Sized.hs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ unsafeUpdate_ = V.unsafeUpdate_
accum :: Unbox a
=> (a -> b -> a) -- ^ accumulating function @f@
-> Vector m a -- ^ initial vector (of length @m@)
-> [(Int,b)] -- ^ list of index/value pairs (of length @n@)
-> [(Finite m,b)] -- ^ list of index/value pairs (of length @n@)
-> Vector m a
accum = V.accum
{-# inline accum #-}
Expand Down
6 changes: 3 additions & 3 deletions vector-sized.cabal
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.33.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack
--
-- hash: e36af7d31e151c5e8d7ad5636dd5d31b47e82d6fe6384f8f76753ed0e17b61b1
-- hash: 8cc33c7ff1b35236dcaed143ba951337eb4f12e3c53c616fa15ec2a073c0942b

name: vector-sized
version: 1.4.4
version: 1.5.0
synopsis: Size tagged vectors
description: Please see README.md
category: Data
Expand Down

0 comments on commit 764e7a8

Please sign in to comment.