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

Lack of functionality for ByteString Arrays. #18

Open
ahgibbons opened this issue Sep 11, 2017 · 3 comments
Open

Lack of functionality for ByteString Arrays. #18

ahgibbons opened this issue Sep 11, 2017 · 3 comments

Comments

@ahgibbons
Copy link

ahgibbons commented Sep 11, 2017

The Data.Array.Repa.Repr.ByteString module provides a way to make arrays from ByteString types using fromByteString. The resulting array has the type Array B sh Word8. It seems that this type is not very useful as there is no equivalent of computeS or computeP for this representation type. Importantly, there seems to be no way to convert any other type of array to an Array B.

Is this implementation incomplete?

@tmcdonell
Copy link
Contributor

tmcdonell commented Sep 23, 2017

I guess it needs an instance for Target. I don't know if it is that this can not be implemented, if it was just not done yet... if you try it out and it works send a PR? (:

@tmcdonell
Copy link
Contributor

iirc ByteString is backed by ForeignPtr, which has a Target instance already, so this should be doable.

@rcannon
Copy link

rcannon commented Apr 9, 2022

@tmcdonell It does seem that the implementation of Target is a bit tricky, since Data.ByteString does not have a mutable interface. For example, newMVec is easy for vector because of the Data.Vector.Mutable.new function, but there is no equivalent for ByteString. One way around this is to just define everything in terms of ForeignPtr Word8 which would mean the Target class looks identical to that for ForeignPtr but with e specified to Word8. This might be desired just for completeness of the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants