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 Unboxed variant #4

Open
phadej opened this issue Nov 5, 2019 · 11 comments
Open

Add Unboxed variant #4

phadej opened this issue Nov 5, 2019 · 11 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@phadej
Copy link
Contributor

phadej commented Nov 5, 2019

Other variants (storable, primitive) would be nice bonus, but Unbox’d vector is often a must thing

@emilypi
Copy link
Owner

emilypi commented Nov 5, 2019

I've been talking about this with @cartazio. I think next up will be Data.Vector.NonEmpty.Unboxed (and hopefully Storable after that), but we were thinking we'd skip Primitive.

The library's at a good state where we can get all the Vector instances we want, so this shouldn't be too much trouble when I have a weekend to hack on it.

@phadej
Copy link
Contributor Author

phadej commented Nov 5, 2019

I agree, that there's little benefit of having Primitive.

@cartazio
Copy link

cartazio commented Nov 5, 2019

you can get all three via having a newtype NonEmptyV v a= NEV (v a) ; newtype NonEmptyMV mv s a = NEMV (mv s a) and then having an the various vector instances etc just pass through plus
by hand or derivingvia to get
instance Vector v a => Vector (NonEmptyV v) v a etc

@phadej
Copy link
Contributor Author

phadej commented Nov 5, 2019

I cannot parse the previous comment.

I also would think very hard whether having Vector (NonEmptyVector a) a instance is all that useful, compared to an opportunity for someone to shoot themselves into a foot.

@emilypi
Copy link
Owner

emilypi commented Nov 6, 2019

That's definitely a possiblity. I'll write it out and see if there are any edge cases we have to worry about.

@cartazio
Copy link

cartazio commented Nov 6, 2019

I agree that maybe the instance Would have footguns. But it would reduce the engineering surface area for all the exposed methods

@emilypi
Copy link
Owner

emilypi commented Nov 6, 2019

My one worry would be that it would introduce upstream variability which could break downstream invariants. It's probably not the case since the Vector class API doesn't really deal much with container structure, but it's still a worry that I'd have to decide to commit to while doing some investigatory implementations.

@cartazio
Copy link

cartazio commented Nov 6, 2019

I’m mostly saying at some level you want / need it internally.

@cartazio
Copy link

cartazio commented Nov 6, 2019

Speaking as upstream: what are possible upstream variations that are physically possible? And not otherwise already possible with any approach you do for your layer?

@emilypi
Copy link
Owner

emilypi commented Nov 6, 2019

I don't know! I don't know the Vector api well enough to say. If you tell me there's no chance I'll believe you and implement it.

@cartazio
Copy link

cartazio commented Nov 6, 2019

Let’s find an hour to sit down with some tea and it’ll be done by the end. It’s really much simpler than you expect I think ;)

@emilypi emilypi added enhancement New feature or request help wanted Extra attention is needed labels Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants