-
Notifications
You must be signed in to change notification settings - Fork 141
Export constructors for vectors from unsafe module #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
f41d88a
to
702c7b0
Compare
I think it would make sense to add an |
Yes it seems in the end library authors need to provide access to internals and it's better to do it systematic way. I hoped to get away with single |
e7237e3
to
32c7585
Compare
I implemented unsafe modules for everything except General idea is to move definition of data type and all function that work directly on vector representation into Unsafe module. It has nice side effect of separating code specific to vector type from endless specializations. At the moment all function safe and unsafe are simply reexported from safe modules. Deprecation warning is only applied to pattern synonym. |
They contain publicly accessible definitions of vector data types and unsafe operations on structure.
32c7585
to
5125015
Compare
Now PR is mostly done. Implementation follows rules below:
Remaining questions
|
for unsafe unboxed vectors
We have 3 sorts of data instances: 1. Constructors that we must exports. Data instances which are used in deriving via (UnboxViaPrim etc.). When constructors aren't visible deriving won't work. They were exported before. 2. Constructors which are safe to use. Newtype vectors over underlying representation. Now they're exported from both immutable and mutable 3. Dangerous and unsafe ones: tuple and unit instances. They're exported from Unsafe module. Mutable module reexports deprecated pattern synonym.
6e2ceb8
to
a44dfb1
Compare
This is proof of concept implementation of #535 for primitive vectors.
Idea work out nicely. There's one small complication. It makes sense to define unsafe function working on representation of a vector but we get name clashes: both mutable and pure primitive vectors defined
unsafeCast
so it pprobab;y makes sense to keep such function where they're currently definedReviews are very welcome.
Fixes #535, Fixes #524, Fixes #517, Fixes #506, Fixes #492, Fixes #171