ANN: primitive 0.6.4.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ANN: primitive 0.6.4.0

Carter Schonwald
This is a pretty exciting (albeit minor version)

I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions

the change log has a huge number of bug fixes relative to 0.6.2-3

also we added some new modules of features 

PrimArray --- unboxed nonsliceable vectors
MVar -- Mvars that run in any PrimMonad

augmented the Data.Primitive exports for increased consistency 
(the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate)

Changes in version 0.6.4.0

  • Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type.

  • Implement isByteArrayPinned and isMutableByteArrayPinned.

  • Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray.

  • Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable.

  • Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it.

  • Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array.

  • Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect.

  • Fix the broken Monad instances for Array and SmallArray.

  • Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array.

  • Fix the implementation of mconcat in the Monoid instance for SmallArray.

  • Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint.

  • Add PrimUnlifted instances for TVar and MVar.

  • Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer.

  • Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types.

  • Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive.

  • Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show.

  • Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types.



_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: ANN: primitive 0.6.4.0

winter
I have make some comments on reddit, but still I want to record them here:
After reading the new code, I got a feeling that there're some API lacking considerations. Here is some of my personal concerns:
  1. The generalized MVar is basically useless because ST is meant to seal its state token, you won't want to add a forkST. You can argue that the atomic operations on MutVar is already added, but still I want to justify its usefulness.

  2. There're too much combinators added to PrimArray, is there a plan to port these to other arrays? 

  3. If we ever provide toList operations, then I would really want it to be a good producer in base's fold-build fusion' view, it's robust and easy to implement, and folding is basically the same speed with List.fold and toList.

Anyway it seems I missed the bike shedding, but still I want to thank for all the efforts, I'll try to follow new GitHub workflow more closely.

Cheers 
Winter


------------------ Original ------------------
From: Carter Schonwald <[hidden email]>
Date: Thu,May 31,2018 2:55 AM
To: haskell-cafe <[hidden email]>, Haskell Libraries <[hidden email]>
Subject: Re: [Haskell-cafe] ANN: primitive 0.6.4.0

This is a pretty exciting (albeit minor version)

I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions

the change log has a huge number of bug fixes relative to 0.6.2-3

also we added some new modules of features 

PrimArray --- unboxed nonsliceable vectors
MVar -- Mvars that run in any PrimMonad

augmented the Data.Primitive exports for increased consistency 
(the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate)

Changes in version 0.6.4.0

  • Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type.

  • Implement isByteArrayPinned and isMutableByteArrayPinned.

  • Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray.

  • Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable.

  • Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it.

  • Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array.

  • Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect.

  • Fix the broken Monad instances for Array and SmallArray.

  • Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array.

  • Fix the implementation of mconcat in the Monoid instance for SmallArray.

  • Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint.

  • Add PrimUnlifted instances for TVar and MVar.

  • Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer.

  • Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types.

  • Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive.

  • Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show.

  • Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types.



_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: ANN: primitive 0.6.4.0

Carter Schonwald
I think your feedback makes perfect sense

(to repeat what i said on reddit)
for MVar: this was an addition Dan Doel and I discussed some years ago but never quite got to. The context is 
1) its totally well behaved (though in isolation theres indeed a valid argument for MutVar instead)
2) it means theres some off the shelf substrate for userland / library land experimentation with approaches to deterministic parallism/concurrency (a la the LVar package or the like)
3) more tools for writing mutable thread safe data structures which may have both pure and mutable interfaces.

as for PrimArray having more operations than the analogous Array and SmallArray, that was definitely an oversight. Its one of those things thats obvious once its said, but easy to lose track of if no one points it out when lost in the weeds

as for lists/fusion, your points make perfect sense.

please feel welcome to chip in on infrastructure/code review when you deem it worthwhile! Ryan and myself are definitely spread thin with our various other focii, and i'm told many collaborating hands make light work (ideally :) )

many thanks :) 
-Carter

On Wed, May 30, 2018 at 4:19 PM, Dr.Koster <[hidden email]> wrote:
I have make some comments on reddit, but still I want to record them here:
After reading the new code, I got a feeling that there're some API lacking considerations. Here is some of my personal concerns:
  1. The generalized MVar is basically useless because ST is meant to seal its state token, you won't want to add a forkST. You can argue that the atomic operations on MutVar is already added, but still I want to justify its usefulness.

  2. There're too much combinators added to PrimArray, is there a plan to port these to other arrays? 

  3. If we ever provide toList operations, then I would really want it to be a good producer in base's fold-build fusion' view, it's robust and easy to implement, and folding is basically the same speed with List.fold and toList.

Anyway it seems I missed the bike shedding, but still I want to thank for all the efforts, I'll try to follow new GitHub workflow more closely.

Cheers 
Winter
发自我的iPhone


------------------ Original ------------------
From: Carter Schonwald <[hidden email]>
Date: Thu,May 31,2018 2:55 AM
To: haskell-cafe <[hidden email]>, Haskell Libraries <[hidden email]>
Subject: Re: [Haskell-cafe] ANN: primitive 0.6.4.0

This is a pretty exciting (albeit minor version)

I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions

the change log has a huge number of bug fixes relative to 0.6.2-3

also we added some new modules of features 

PrimArray --- unboxed nonsliceable vectors
MVar -- Mvars that run in any PrimMonad

augmented the Data.Primitive exports for increased consistency 
(the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate)

Changes in version 0.6.4.0

  • Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type.

  • Implement isByteArrayPinned and isMutableByteArrayPinned.

  • Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray.

  • Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable.

  • Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it.

  • Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array.

  • Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect.

  • Fix the broken Monad instances for Array and SmallArray.

  • Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array.

  • Fix the implementation of mconcat in the Monoid instance for SmallArray.

  • Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint.

  • Add PrimUnlifted instances for TVar and MVar.

  • Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer.

  • Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types.

  • Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive.

  • Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show.

  • Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types.




_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: ANN: primitive 0.6.4.0

Andrew Martin
In reply to this post by winter
Thanks for the feedback. Also, thanks for the giant PR you made a year ago. Several of the things I implemented in this release were just things I ripped out of it and put into smaller PRs. To address your questions:

- There are more combinators in PrimArray than there are in the other modules. This is an inconsistency in the library design. We need to come up with a policy for what combinators are accepted. It’s weird to have a Foldable instance for Array but not get access to foldl’ and foldr for PrimArray and UnliftedArray. Similarly, functions for mapping and travsersing seem reasonable just so that you have access to the same interface if you switch from using Array to one of the other array types that isn’t fully polymorphic in its element type. I’ve considered removing some of the functions (like replicatePrimArray) in a future release. The maintainers of primitive don’t all share the same view on what exactly should be there, so we probably need to come up with a policy around this.
- We should definitely have toList be a good producer. This has been discussed in other PRs. A PR for this would be accepted.
- The generalized MVar is basically useless without unsafely extending it (ie forkST). But, everything provided is 100% deterministic. You have to write forkST on your own and take on the burden of proving that you use it in a way that results in deterministic behavior. I have written a package that implements a parallel variant of mergesort that needs this kind of this. I think there’s something Carter wanted to do with this as well.

Sent from my iPhone

On May 30, 2018, at 4:19 PM, Dr.Koster <[hidden email]> wrote:

I have make some comments on reddit, but still I want to record them here:
After reading the new code, I got a feeling that there're some API lacking considerations. Here is some of my personal concerns:
  1. The generalized MVar is basically useless because ST is meant to seal its state token, you won't want to add a forkST. You can argue that the atomic operations on MutVar is already added, but still I want to justify its usefulness.

  2. There're too much combinators added to PrimArray, is there a plan to port these to other arrays? 

  3. If we ever provide toList operations, then I would really want it to be a good producer in base's fold-build fusion' view, it's robust and easy to implement, and folding is basically the same speed with List.fold and toList.

Anyway it seems I missed the bike shedding, but still I want to thank for all the efforts, I'll try to follow new GitHub workflow more closely.

Cheers 
Winter


------------------ Original ------------------
From: Carter Schonwald <[hidden email]>
Date: Thu,May 31,2018 2:55 AM
To: haskell-cafe <[hidden email]>, Haskell Libraries <[hidden email]>
Subject: Re: [Haskell-cafe] ANN: primitive 0.6.4.0

This is a pretty exciting (albeit minor version)

I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions

the change log has a huge number of bug fixes relative to 0.6.2-3

also we added some new modules of features 

PrimArray --- unboxed nonsliceable vectors
MVar -- Mvars that run in any PrimMonad

augmented the Data.Primitive exports for increased consistency 
(the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate)

Changes in version 0.6.4.0

  • Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type.

  • Implement isByteArrayPinned and isMutableByteArrayPinned.

  • Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray.

  • Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable.

  • Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it.

  • Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array.

  • Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect.

  • Fix the broken Monad instances for Array and SmallArray.

  • Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array.

  • Fix the implementation of mconcat in the Monoid instance for SmallArray.

  • Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint.

  • Add PrimUnlifted instances for TVar and MVar.

  • Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer.

  • Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types.

  • Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive.

  • Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show.

  • Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types.


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.