-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add strict boxed vectors #483
Comments
I've done the same in We could potentially take the same approach here and just define the types with instances and let the users rely on the Generic interface. |
I think it would be better to maintain same style for all modules. I guess we're stuck with the decision. If GHC API has stabilized somewhat it would be possible to write tool for applying documentation changes and to generate reexports automatically |
This could be a separate library. Then the argument for duplicating all the functions is less strong and it wouldn't make compilation slower for everyone who doesn't need strict boxed vectors. |
Separate library would result in rather poor usability. User would have to find another library and that's for rather basic functionality. As an example |
The library could be linked from the |
I am with @Shimuuar on this one. I would even go so far as advocating strict boxed vector as the default one that users should reach out for, instead of the current lazy one. Also, it would be in line with other packages, like Extra 10 seconds of compile time is a small price for having this feature, IMHO. |
Is it the same as included in https://hackage.haskell.org/package/strict-containers? I use these with gusto. |
Yes. My plan was to copy definition of lazy vector, make It should be essentially the same. |
I don't know or don't remember the details, so let me ping @infinity0. As a user, I think I'd expect the conversion to force all elements, yes. |
I support the proposal since it means I'll have less maintenance work in As for implementation, my patch is against vector-0.13 and I think Also I provide explicit strict versions of the G.Vector API (it results in a smaller patch for me, to duplicate more of vector) and override There may have been other things I missed, but it worked well for me back when I used it - it passed a bunch of strictness tests I wrote, and it seems @Mikolaj hasn't found any bugs so far. :) |
More details about my patch. The results are here: https://github.com/haskellari/strict-containers/tree/master/strict-containers/src/Data/Strict/Vector We only need to duplicate 3 files from Vector:
The patch linked above is then applied onto this. Then a bunch of stuff is re-exported as Data.Strict.Vector. I didn't think about how |
The earlier discussion: #380 |
This is inspired by thread on discource. We don 't have any good way to ensure that elements of boxed vector are evaluated. Namely any use of
map
,zip
, etc will not evaluate vector's elements. And if used in iterative algorithms as in thread above it will leak memory. We don't even have standard way of evaluating all elements of vector to WHNF.From users' PoV easiest way is to add boxed vector which is strict in its elements. It would be also most reliable. And since strictness is tied to strictness of
basicWrite
we have to define new data type.As much as I hate adding (and supporting) another vector data type I think this addition is valuable enough. @lehins @Bodigrim what is your opinion?
I
The text was updated successfully, but these errors were encountered: