Skip to content
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 support for vectors/arrays #2

Open
edsko opened this issue Mar 11, 2021 · 6 comments
Open

Add support for vectors/arrays #2

edsko opened this issue Mar 11, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@edsko
Copy link
Collaborator

edsko commented Mar 11, 2021

Boxed vectors are already supported, but adding support for the other flavours is a bit trickier:

  • Storable and Primitive vectors have a Storable constraint on the element type, and we have no Storable instance for Void. We could define an oprhan, but even then I'm not sure that casting an empty Vector a to Vector Void is safe. Needs a bit of thought.
  • Unboxed is a data family; not necessarily a problem, just requires a lot of cases.
@edsko
Copy link
Collaborator Author

edsko commented Mar 29, 2021

We can't actually infer anything for Storable; see

-- | Storable vector ("Data.Vector.Storable")

@edsko
Copy link
Collaborator Author

edsko commented Apr 2, 2021

Same goes for primitive vectors.

@edsko
Copy link
Collaborator Author

edsko commented Apr 2, 2021

As it turns out, we can in principle do better for unboxed arrays; I figured out the technical details of how to deal with the data family in 76c70e1 . However, unfortunately it turns out all of the instances of the Vector type family are all newtype instances, not data instances, and so aren't visible on the heap at all :-( This means that all we see are the underlying primitive vectors, for which we can basically do no classification.

@edsko
Copy link
Collaborator Author

edsko commented Apr 2, 2021

This means that vector is now dealt with; remains to deal with array, which is at least partly based around GHC.Arr. Once we have support for array I think all primitive types are accounted for.

@edsko
Copy link
Collaborator Author

edsko commented Jun 30, 2021

Opened haskell/vector#391 to ask about #2 (comment) .

@edsko
Copy link
Collaborator Author

edsko commented Jun 30, 2021

WIP PR at #22 .

@edsko edsko added the enhancement New feature or request label Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant