packages/primitive.git
3 days agoadd functions for working with pinned PrimArrays (#217) master
Andrew Martin [Fri, 17 May 2019 17:03:07 +0000 (13:03 -0400)] 
add functions for working with pinned PrimArrays (#217)

* add functions for working with pinned PrimArrays

* add pinnedness predicates for PrimArray

3 days agomark the 8.8.1 RC as a ghc head so hackage-head patches can be used
Carter Tazio Schonwald [Fri, 17 May 2019 15:01:03 +0000 (11:01 -0400)] 
mark the 8.8.1 RC as a ghc head so hackage-head patches can be used

3 days agoadd some updated to the changelog plus add 8.8.1 to the CI matrix
Carter Tazio Schonwald [Thu, 16 May 2019 22:54:28 +0000 (18:54 -0400)] 
add some updated to the changelog plus add 8.8.1 to the CI matrix

3 days agolets test only most recent 8.6.5, not earlier bug fix releases
Carter Tazio Schonwald [Thu, 16 May 2019 22:40:13 +0000 (18:40 -0400)] 
lets test only most recent 8.6.5, not earlier bug fix releases

3 days agoDoc cleanups regarding "Affine" safety assumption on PrimMonad
Carter Tazio Schonwald [Thu, 16 May 2019 22:25:32 +0000 (18:25 -0400)] 
Doc cleanups regarding "Affine" safety assumption on PrimMonad
still much more to do, but the core of it is
"dont run any effects more than once, and you'll have a good day"

3 days agogetting this working right in 7.10 for the test suite
Carter Tazio Schonwald [Thu, 16 May 2019 19:58:25 +0000 (15:58 -0400)] 
getting this working right in 7.10 for the test suite

more compat tomfoolery in test suites
plus improving testsuite compat pre eq1/eq2 existence

3 days agothis is gonna be v0.7 just to be clear :)
Carter Tazio Schonwald [Thu, 16 May 2019 17:35:31 +0000 (13:35 -0400)] 
this is gonna be v0.7 just to be clear :)

3 days agoadd semigroup dep for testsuite
Carter Tazio Schonwald [Thu, 16 May 2019 17:34:21 +0000 (13:34 -0400)] 
add semigroup dep for testsuite

more fixing up noDuplicate for old ghcs. I will stand on this hill of reducing unsafeCoerce# occurrences

3 days agofix noduplicate support on older ghc
Carter Tazio Schonwald [Thu, 16 May 2019 17:01:35 +0000 (13:01 -0400)] 
fix noduplicate support on older ghc

3 days agoregenerated travis file
Carter Tazio Schonwald [Thu, 16 May 2019 16:50:34 +0000 (12:50 -0400)] 
regenerated travis file

3 days agokill an unused import
Carter Tazio Schonwald [Thu, 16 May 2019 16:30:31 +0000 (12:30 -0400)] 
kill an unused import

cleanup details in .cabal file and kill a newline

3 days agomore misc cleanups
Carter Tazio Schonwald [Thu, 16 May 2019 16:18:28 +0000 (12:18 -0400)] 
more misc cleanups

3 days agoremove word8 reexport
Carter Tazio Schonwald [Thu, 16 May 2019 15:49:48 +0000 (11:49 -0400)] 
remove word8 reexport

3 days agomove the prim laws out of QC so we can workshop them
Carter Tazio Schonwald [Thu, 16 May 2019 15:25:17 +0000 (11:25 -0400)] 
move the prim laws out of QC so we can workshop them

3 days agovendoring qc-classes in test suite for now
Carter Tazio Schonwald [Thu, 16 May 2019 15:17:13 +0000 (11:17 -0400)] 
vendoring qc-classes in test suite for now

3 days agoremoving unlifted array support, removing Addr data type
Carter Tazio Schonwald [Thu, 16 May 2019 15:16:14 +0000 (11:16 -0400)] 
removing unlifted array support, removing Addr data type

3 days agowork in progress for v0.7 branch
Carter Tazio Schonwald [Fri, 26 Apr 2019 21:35:03 +0000 (17:35 -0400)] 
work in progress for v0.7 branch

3 days agoAdd CPS transformer variants (#227)
David Feuer [Thu, 16 May 2019 22:22:51 +0000 (18:22 -0400)] 
Add CPS transformer variants (#227)

Add `PrimMonad` instances for `Control.Monad.Trans.Writer.CPS`
and `Control.Monad.Trans.RWS.CPS`.

Closes #226

4 days agoremove all imports of GHC.Prim (#236)
chessai [Thu, 16 May 2019 16:15:24 +0000 (12:15 -0400)] 
remove all imports of GHC.Prim (#236)

2 weeks agorelax bound on master to allow building with ghc 8.8
Carter Tazio Schonwald [Wed, 1 May 2019 19:03:26 +0000 (15:03 -0400)] 
relax bound on master to allow building with ghc 8.8

3 weeks agoElaborate in the docs for the Prim typeclass. Mention that endianness is platform...
Andrew Martin [Thu, 25 Apr 2019 19:02:10 +0000 (15:02 -0400)] 
Elaborate in the docs for the Prim typeclass. Mention that endianness is platform-dependent.

5 weeks agoAdapt to MonadFail-related changes in base-4.13 v0.6.4
Ryan Scott [Wed, 20 Mar 2019 13:59:18 +0000 (09:59 -0400)] 
Adapt to MonadFail-related changes in base-4.13

`base-4.13` will finally complete the `MonadFail` proposal by
removing the `fail` method from `Monad`. This adapts `primitive` to
that change by guarding the existing `fail` implementations in
primitive (for `Array` and `SmallArray`) behind CPP, and defining
`MonadFail` instances for `Array` and `SmallArray` going forward.

2 months agoRegenerate .travis.yml
Ryan Scott [Tue, 5 Mar 2019 18:48:20 +0000 (13:48 -0500)] 
Regenerate .travis.yml

This commit was performed automatically by a script.
https://github.com/RyanGlScott/travis-maintenance

2 months agoFactor out haskell-ci configuration
Ryan Scott [Tue, 5 Mar 2019 18:46:28 +0000 (13:46 -0500)] 
Factor out haskell-ci configuration

2 months agoRevert "Comment out showReadLaws until #223 is fixed"
Ryan Scott [Tue, 26 Feb 2019 11:04:09 +0000 (06:04 -0500)] 
Revert "Comment out showReadLaws until #223 is fixed"

This reverts commit 77ee500e6e96dfed468586df19269bcd7da5c71a.

Now that #223 has been fixed, this hack is no longer necessary.

2 months agoRead arrays more flexibly (#224)
David Feuer [Tue, 26 Feb 2019 01:03:06 +0000 (20:03 -0500)] 
Read arrays more flexibly (#224)

Use the `ReadPrec` mechanism instead of the `ReadS` one Allow reading
"`OverloadedList` style" and "`OverloadedString`" style, along with
`fromList` and `fromListN` style.  The `fromListN` syntax only supports decimal.

Fixes #223

3 months agoComment out showReadLaws until #223 is fixed
Ryan Scott [Thu, 14 Feb 2019 14:47:50 +0000 (09:47 -0500)] 
Comment out showReadLaws until #223 is fixed

3 months agotrim trailing white space thats in a few modules
Carter Tazio Schonwald [Tue, 5 Feb 2019 21:17:13 +0000 (16:17 -0500)] 
trim trailing white space thats in a few modules

3 months agoclarify language in documentation of current limitations in copyMutableArray
Carter Tazio Schonwald [Tue, 5 Feb 2019 21:16:11 +0000 (16:16 -0500)] 
clarify language in documentation of current limitations in copyMutableArray
 in the Array module, plus fix a name shadowing warning in
 definition of unsafeDupableInterleave

3 months agotemporary fix for semantic issues in copyMutableArray in the Primitive Array module
Carter Tazio Schonwald [Tue, 5 Feb 2019 21:11:16 +0000 (16:11 -0500)] 
temporary fix for semantic issues in copyMutableArray in the Primitive Array module

4 months agoImprove foldrByteArray
Bodigrim [Fri, 4 Jan 2019 23:42:46 +0000 (23:42 +0000)] 
Improve foldrByteArray

5 months agoFix documentation comment for copyMutableArray. (#220)
Varun Gandhi [Wed, 12 Dec 2018 18:05:43 +0000 (13:05 -0500)] 
Fix documentation comment for copyMutableArray. (#220)

Fix documentation comment for copyMutableArray.

5 months agoRegenerate .travis.yml
Ryan Scott [Mon, 10 Dec 2018 12:01:46 +0000 (07:01 -0500)] 
Regenerate .travis.yml

This commit was performed automatically by a script.
https://github.com/RyanGlScott/travis-maintenance

6 months agoresume supporting pre 4.11 base
Carter Tazio Schonwald [Wed, 14 Nov 2018 22:51:46 +0000 (17:51 -0500)] 
resume supporting pre 4.11 base

6 months agoRegenerate .travis.yml
Ryan Scott [Tue, 6 Nov 2018 14:04:20 +0000 (09:04 -0500)] 
Regenerate .travis.yml

This commit was performed automatically by a script.
https://github.com/RyanGlScott/travis-maintenance

7 months agoRegenerate .travis.yml
Ryan Scott [Wed, 17 Oct 2018 18:59:17 +0000 (14:59 -0400)] 
Regenerate .travis.yml

This commit was performed automatically by a script.
https://github.com/RyanGlScott/travis-maintenance

7 months agoDon't use --local-ghc-options=-Wall
Ryan Scott [Wed, 17 Oct 2018 17:34:01 +0000 (13:34 -0400)] 
Don't use --local-ghc-options=-Wall

This will become redundant with travis-maintenance
(https://github.com/RyanGlScott/travis-maintenance)

7 months agoadding test and bench documentation to readme
Carter Tazio Schonwald [Mon, 1 Oct 2018 22:32:01 +0000 (18:32 -0400)] 
adding test and bench documentation to readme
(though the current workflow could stand some cleanup)

7 months agotrim trailing whitespace
Carter Tazio Schonwald [Mon, 1 Oct 2018 22:26:18 +0000 (18:26 -0400)] 
trim trailing whitespace

7 months agoremoving -Wall from PrimArray module
Carter Tazio Schonwald [Mon, 1 Oct 2018 21:51:38 +0000 (17:51 -0400)] 
removing -Wall from PrimArray module

Wall in released library code only ends in tears.

Also updated gitignore

7 months agoTravis: Fully enable GHC 8.6
Ryan Scott [Sat, 22 Sep 2018 13:03:06 +0000 (09:03 -0400)] 
Travis: Fully enable GHC 8.6

8 months agoUse newly-exported StableName constructor (#209)
David Feuer [Tue, 28 Aug 2018 17:14:53 +0000 (13:14 -0400)] 
Use newly-exported StableName constructor (#209)

GHC 8.6 will export the `StableName` constructor from
`GHC.StableName`, meaning we won't have to pull an ugly
`unsafeCoerce` trick to get at its guts.

8 months agointerleave (#208)
M Farkas-Dyck [Sun, 26 Aug 2018 00:07:54 +0000 (16:07 -0800)] 
interleave (#208)

* interleave

* Update Primitive.hs

* Fix pre-AMP wibble

* changelog

9 months agoMerge pull request #204 from treeowl/prim-stable
David Feuer [Sun, 19 Aug 2018 21:11:32 +0000 (17:11 -0400)] 
Merge pull request #204 from treeowl/prim-stable

 Add Prim instances for stable things

9 months agoadd tests for range-setting operations for StablePtr and StableName
Andrew Martin [Sun, 19 Aug 2018 18:13:40 +0000 (14:13 -0400)] 
add tests for range-setting operations for StablePtr and StableName

9 months agoUpdate changelog
David Feuer [Sun, 19 Aug 2018 04:57:57 +0000 (00:57 -0400)] 
Update changelog

9 months agotest PrimUnlifted instance for StableName
Andrew Martin [Sat, 18 Aug 2018 17:47:30 +0000 (13:47 -0400)] 
test PrimUnlifted instance for StableName

9 months agoAdd test for Prim instance of StablePtr. Add tests for all Prim instances of Word...
Andrew Martin [Sat, 18 Aug 2018 17:32:36 +0000 (13:32 -0400)] 
Add test for Prim instance of StablePtr. Add tests for all Prim instances of Word/Int of all sizes.

9 months agoAdd Prim instances for stable things
David Feuer [Fri, 17 Aug 2018 19:37:12 +0000 (15:37 -0400)] 
Add Prim instances for stable things

* Add a `Prim` instance for `StablePtr` and a `PrimUnlifted`
instance for `StableName`.

* Add a `Generic` instance for `Addr`.

Closes #201

9 months agoUpdate changelog.md
David Feuer [Sat, 18 Aug 2018 03:41:54 +0000 (23:41 -0400)] 
Update changelog.md

9 months agoUpdate changelog.md
David Feuer [Sat, 18 Aug 2018 03:36:23 +0000 (23:36 -0400)] 
Update changelog.md

9 months agoSet the stage for UnliftedArray# (#196)
David Feuer [Fri, 17 Aug 2018 22:02:18 +0000 (18:02 -0400)] 
Set the stage for UnliftedArray# (#196)

The `PrimUnlifted` class, used to implement `UnliftedArray`
operations, is currently based on an `ArrayArray#` representation
of unlifted arrays. But that's set to change, hopefully soon.
I don't think it's too soon to set up the machinery necessary to
allow users to write code *today* that will work once `ArrayArray#`
is gone.

The key here is to add an associated type family to `PrimUnlifted`
that ties each `LiftedRep` type to its `UnliftedRep` counterpart,
and methods that convert back and forth.

9 months agoFix PrimUnlifted instances for small arrays (#203)
David Feuer [Fri, 17 Aug 2018 20:47:00 +0000 (16:47 -0400)] 
Fix PrimUnlifted instances for small arrays (#203)

When using GHC versions before 7.10, `SmallArray` is a newtype
wrapper around `Array`, and similarly `SmallMutableArray` is a
newtype wrapper around `MutableArray`. So the `PrimUnlifted`
instances need to go through two layers of constructors to get
to an unlifted type. Previously we failed to do that, leading
to invalid and dangerous coercions.

Fixes #199

9 months agoremove PrimUnlifted instance for StablePtr (#202)
Andrew Martin [Fri, 17 Aug 2018 19:43:19 +0000 (15:43 -0400)] 
remove PrimUnlifted instance for StablePtr (#202)

* remove PrimUnlifted instance for StablePtr

* add notes

* Update changelog.md

* Update UnliftedArray.hs

9 months agoFix atomicModifyMutVar'
David Feuer [Tue, 14 Aug 2018 21:14:12 +0000 (17:14 -0400)] 
Fix atomicModifyMutVar'

`atomicModifyMutVar'` was rather lazier than intented.
Copy the correct implementation over from `base`.

9 months agoarbitraTy -> arbitraRy
chessai [Mon, 23 Jul 2018 20:13:00 +0000 (16:13 -0400)] 
arbitraTy -> arbitraRy

10 months agoFix compilation error by recent ghc-head (#187)
Shao Cheng [Tue, 17 Jul 2018 09:17:27 +0000 (17:17 +0800)] 
Fix compilation error by recent ghc-head (#187)

10 months agoAllow base-4.12
Ryan Scott [Tue, 10 Jul 2018 17:06:54 +0000 (13:06 -0400)] 
Allow base-4.12

Fixes #179.

10 months agofix since pragmas from 0641 -> 0650
chessai [Fri, 6 Jul 2018 19:25:38 +0000 (15:25 -0400)] 
fix since pragmas from 0641 -> 0650

10 months agoadd @since pragmas for newtypes
chessai [Fri, 6 Jul 2018 17:21:13 +0000 (13:21 -0400)] 
add @since pragmas for newtypes

10 months agoadd prim instances for base newtypes, and associated tests (#182)
chessai [Fri, 6 Jul 2018 16:58:08 +0000 (12:58 -0400)] 
add prim instances for base newtypes, and associated tests (#182)

* add prim instances for base newtypes

* depend on base-orphans to simplify CPP

* mark changes in changelog

10 months agoban vim swap files in .gitignore
chessai [Thu, 5 Jul 2018 16:27:59 +0000 (12:27 -0400)] 
ban vim swap files in .gitignore

10 months agoUncomment DerivingVia test
Ryan Scott [Sun, 1 Jul 2018 18:41:06 +0000 (14:41 -0400)] 
Uncomment DerivingVia test

10 months ago--no-install-dependencies
Ryan Scott [Sun, 1 Jul 2018 17:29:47 +0000 (13:29 -0400)] 
--no-install-dependencies

10 months agoTravis: Use GHC 8.6.1
Ryan Scott [Sun, 1 Jul 2018 17:23:01 +0000 (13:23 -0400)] 
Travis: Use GHC 8.6.1

10 months agoadd benchmarks for different implementations of inequality functions
Andrew Martin [Mon, 25 Jun 2018 18:56:59 +0000 (14:56 -0400)] 
add benchmarks for different implementations of inequality functions

11 months agoUse GHC 8.4.3 on Travis
Ryan Scott [Sun, 3 Jun 2018 11:55:03 +0000 (07:55 -0400)] 
Use GHC 8.4.3 on Travis

11 months agoSquash some warnings in the tests and benchmarks
Ryan Scott [Sat, 2 Jun 2018 16:15:51 +0000 (12:15 -0400)] 
Squash some warnings in the tests and benchmarks

11 months agoEnable -Wall only locally and on Travis
Ryan Scott [Sat, 2 Jun 2018 15:22:22 +0000 (11:22 -0400)] 
Enable -Wall only locally and on Travis

Fixes #169.

11 months agoUpdate changelog.md
Andrew Martin [Wed, 30 May 2018 19:16:29 +0000 (15:16 -0400)] 
Update changelog.md

11 months agoadd mvar to changelog
Andrew Martin [Wed, 30 May 2018 18:55:19 +0000 (14:55 -0400)] 
add mvar to changelog

11 months agobump version to 0.6.4.0 for release
Carter Tazio Schonwald [Wed, 30 May 2018 18:38:21 +0000 (14:38 -0400)] 
bump version to 0.6.4.0 for release

* added Data.Primitive.MutVar to exports for Data.Primitive and moved commas to left
* removed Wall from ghc options
* removed cc-options from from c files

11 months agoDefault prim implementations (#165)
Andrew Martin [Wed, 30 May 2018 17:29:09 +0000 (13:29 -0400)] 
Default prim implementations (#165)

* default implementations of setByteArray and setOffAddr along with examples.

* make types of default primitive methods more concise and add changelog entry

* add simple test for default implementations of set functions

11 months agoOrd Instance Documentation (#162)
Andrew Martin [Wed, 30 May 2018 17:27:33 +0000 (13:27 -0400)] 
Ord Instance Documentation (#162)

* Document the ordering used by each Ord instance. Change the Ord instance for PrimArray to use a lexicographic ordering.

* document that Ord instances are subject to change between major versions

11 months agocorrect misleading annotations on 'sizeOf' and 'alignment'
chessai [Thu, 24 May 2018 17:46:32 +0000 (13:46 -0400)] 
correct misleading annotations on 'sizeOf' and 'alignment'

11 months agoadd since metadata from 0.6 to 0.6.3
chessai [Thu, 24 May 2018 17:27:26 +0000 (13:27 -0400)] 
add since metadata from 0.6 to 0.6.3

11 months agoDisable semirings support in quickcheck-classes (#164)
Andrew Martin [Fri, 25 May 2018 12:24:59 +0000 (08:24 -0400)] 
Disable semirings support in quickcheck-classes (#164)

* disable semirings support in quickcheck-classes to accelerate building the test suite

* require backwards-compat fix for quickcheck-classes

11 months agoMerge pull request #163 from andrewthad/since_pragmas
Andrew Martin [Thu, 24 May 2018 15:29:34 +0000 (11:29 -0400)] 
Merge pull request #163 from andrewthad/since_pragmas

add since pragmas to everything introduced in primitive-0.6.4.0

11 months agoadd since pragmas to everything introduced in primitive-0.6.4.0
Andrew Martin [Thu, 24 May 2018 15:13:28 +0000 (11:13 -0400)] 
add since pragmas to everything introduced in primitive-0.6.4.0

11 months agoUnlifted array functions (#156)
Andrew Martin [Wed, 23 May 2018 03:27:50 +0000 (23:27 -0400)] 
Unlifted array functions (#156)

* Add more typeclass instances for UnliftedArray. Add folds and map for UnliftedArray. Export list conversion functions for PrimArray.

* document changes to UnliftedArray in changelog

* fix backwards-compat problems in UnliftedArray

* import Data.Semigroup in UnliftedArray

* Improve docs for UnliftedArray. Add runUnliftedArray.

* better unboxing across runST for UnliftedArray

* make sure runRW# is available on GHC 8.0.2

11 months agoimplement MVar in PrimMonad (#150)
Andrew Martin [Mon, 21 May 2018 14:34:46 +0000 (10:34 -0400)] 
implement MVar in PrimMonad (#150)

* implement MVar in PrimMonad

* more simple implementation of putMVar

* make MVar backward compatible by removing readMVar and tryReadMVar on older GHCs

* tweak docs for mvar

* make readMVar work on old GHC

* Make older GHCs support tryTakeMVar

* improve docs for readMVar and tryReadMVar

* drop unneeded parens in Eq instance for MVar

* improve backwards-compat docs for readMVar and tryReadMVar

12 months agoAdd function for copying from Ptr to MutablePrimArray (#158)
Andrew Martin [Sat, 5 May 2018 13:30:52 +0000 (09:30 -0400)] 
Add function for copying from Ptr to MutablePrimArray (#158)

* add function for copying from Ptr to MutablePrimArray

* conditionally import PrimArray into Ptr

12 months agoFix broken mconcat for SmallArray (#157)
Andrew Martin [Fri, 4 May 2018 20:09:07 +0000 (16:09 -0400)] 
Fix broken mconcat for SmallArray (#157)

* Fix broken mconcat for `SmallArray`.

* Document the fix for `SmallArray`'s mconcat in the changelog.

12 months agoexport unary tuple indexing functions for Array and SmallArray (#143)
Andrew Martin [Tue, 1 May 2018 20:34:09 +0000 (16:34 -0400)] 
export unary tuple indexing functions for Array and SmallArray (#143)

* export unary tuple indexing functions for Array and SmallArray

* make sure indexSmallArray## is defined on old GHCs. Stop redefining indexArray## in benchmark suite.

12 months agoUse GHC 8.4.2 on Travis
Ryan Scott [Fri, 20 Apr 2018 17:48:42 +0000 (13:48 -0400)] 
Use GHC 8.4.2 on Travis

12 months agoRename unsafe traversals (#137)
Andrew Martin [Fri, 20 Apr 2018 12:25:09 +0000 (08:25 -0400)] 
Rename unsafe traversals (#137)

Rename unsafe traversals

13 months agoAdd strict map functions for Array and SmallArray (#138)
Andrew Martin [Thu, 19 Apr 2018 16:58:31 +0000 (12:58 -0400)] 
Add strict map functions for Array and SmallArray (#138)

Add strict map functions for `Array` and `SmallArray`.

13 months agoAdd PrimStorable for deriving getting a Storable instance from a Prim instance (...
Andrew Martin [Thu, 19 Apr 2018 15:04:49 +0000 (11:04 -0400)] 
Add PrimStorable for deriving getting a Storable instance from a Prim instance (#136)

* Add PrimStorable for deriving getting a Storable instance from a Prim instance

* fix name of example type in docs for PrimStorable

* add tests to be run once GHC 8.6 comes out

13 months agoeliminate needless reexport of sizeOf and alignment from Data.Primitive (#135)
Andrew Martin [Thu, 19 Apr 2018 14:03:39 +0000 (10:03 -0400)] 
eliminate needless reexport of sizeOf and alignment from Data.Primitive (#135)

13 months agodocument in detail the extent of the depravity from which the old Array typeclass...
Andrew Martin [Thu, 19 Apr 2018 13:30:31 +0000 (09:30 -0400)] 
document in detail the extent of the depravity from which the old Array typeclass instances suffered (#133)

13 months agoImplement PrimArray (#106)
Andrew Martin [Thu, 19 Apr 2018 12:36:21 +0000 (08:36 -0400)] 
Implement PrimArray (#106)

* initial implementation of PrimArray

* more tweaks to PrimArray

* start adding folds and traversals for PrimArray

* add PrimAffineMonad

* make getSizeofMutablePrimArray backwards-compatible

* rename functions in Data.Primitive.PrimArray

* rename PrimArray functions again

* make tests build again

* add note about why the getSizeofMutablePrimArray shim is safe

* improve documentation of PrimArray

* implement filterPrimArray and resizeMutablePrimArray

* add shrinkMutablePrimArray on sufficiently new GHCs

* add witherPrimArray, which is mapMaybe

* Add filter and wither (mapMaybe) and start on their effectful variants. Add more tests.

* try to fix things for backwards compatibility

* Fix test suite for old GHCs. Fix resizing function. Rename wither to mapMaybe.

* make test suite build on GHC 7.4 and GHC 7.6

* Eliminate PrimAffineMonad

* make primArrayToList a good list producer

* tidy up Eq instance for PrimArray

* Add Ord instance for PrimArray. Add tests for PrimArray instances. Fix Eq instance.

* import (<>) in Data.Primitive.PrimArray for older GHCs

* add example to docs showing how to use traversePrimArrayP instead of traversePrimArray

* prove that traversePrimArrayP dominates traversePrimArray in simple situations

* Avoid importing <> from Data.Semigroup

* finish adding applicitave and prim monadic variants of filter and mapMaybe

* add haddocks for all functions in Data.Primitive.PrimArray

* reexport Data.Prim.PrimArray in Data.Primitive

* fix cyclic import between Data.Primitive and Data.Primitive.PrimArray

* bump lower bound for quickcheck-classes dependency

* replace uses of the word 'bytes' with 'elements' in docs for PrimArray

* Fix typos. Document naming conventions.

* test Monoid properties for PrimArray. Remove unused function from Data.Primitive.PrimArray.

13 months agoData.Primitive.Ptr (#108)
Andrew Martin [Fri, 6 Apr 2018 17:36:57 +0000 (13:36 -0400)] 
Data.Primitive.Ptr (#108)

* initial implementation of Data.Primitive.Ptr

* implement subtractPtr

* Make copyPtr and movePtr interpret their length as a number of
elements instead of as a number of bytes.

* require Prim instance for movePtr and copyPtr

* Correct typos in documentation of Data.Primitive.Ptr functions

* correct docs for Data.Primitive.Ptr to say elements instead of bytes

13 months agoadd PrimUnlifted instances for TVar and MVar (#119)
Andrew Martin [Fri, 6 Apr 2018 16:00:05 +0000 (12:00 -0400)] 
add PrimUnlifted instances for TVar and MVar (#119)

* add PrimUnlifted instances for TVar and MVar

* add a few more PrimUnlifted instances

13 months agowarn against the dangers of sizeofMutableByteArray (#129)
Andrew Martin [Fri, 6 Apr 2018 15:59:42 +0000 (11:59 -0400)] 
warn against the dangers of sizeofMutableByteArray (#129)

13 months agoTest resizeByteArray (#128)
Andrew Martin [Wed, 4 Apr 2018 18:00:39 +0000 (14:00 -0400)] 
Test resizeByteArray (#128)

* Write tests to ensure that the implementation of resizeByteArray
on older GHCs, which uses a shim, behaves the same as the implementation
on newer GHCs, which uses a primop.

* add description of property tests for resizeByteArray

13 months agoreexport SmallArray and UnliftedArray types and functions from Data.Primitive (#126)
Andrew Martin [Wed, 4 Apr 2018 12:44:16 +0000 (08:44 -0400)] 
reexport SmallArray and UnliftedArray types and functions from Data.Primitive (#126)

* reexport SmallArray and UnliftedArray types and functions from Data.Primitive

* Import SmallArray and UnliftedArray modules into Data.Primitive

13 months agoimplement isByteArrayPinned and isMutableByteArrayPinned (#117)
Andrew Martin [Tue, 3 Apr 2018 13:27:04 +0000 (09:27 -0400)] 
implement isByteArrayPinned and isMutableByteArrayPinned (#117)

* implement isByteArrayPinned and isMutableByteArrayPinned

* add changelog entry for functions that test whether or not a bytearray is pinned

* use isTrue instead of manually casing for byte array pinned checks

13 months agoMerge branch 'bgamari-addr-functions'
Ryan Scott [Tue, 3 Apr 2018 12:36:57 +0000 (08:36 -0400)] 
Merge branch 'bgamari-addr-functions'

13 months agoMerge branch 'addr-functions' of https://github.com/bgamari/primitive into bgamari...
Ryan Scott [Tue, 3 Apr 2018 12:36:47 +0000 (08:36 -0400)] 
Merge branch 'addr-functions' of https://github.com/bgamari/primitive into bgamari-addr-functions

Conflicts:
Data/Primitive/Addr.hs
Data/Primitive/ByteArray.hs

13 months agoUse compareByteArrays# (#118)
Andrew Martin [Tue, 3 Apr 2018 12:29:57 +0000 (08:29 -0400)] 
Use compareByteArrays# (#118)

* Use compareByteArrays# for the Eq and Ord instance of ByteArray
when building with GHC 8.4 or newer. Add tests to ensure that
the behavior of the Eq and Ord instances are consistent across
different versions of GHC. Additionally, export byteArrayFromList
and byteArrayFromListN, which are helpful for making the test
suite backwards-compatible.

* make compareLengthFirst more succinct

* fix definition of compareLengthFirst

* import Data.Function in test suite