Skip to content

Array Semigroup instance should check length #63

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

Closed
natefaubion opened this issue Mar 14, 2016 · 2 comments
Closed

Array Semigroup instance should check length #63

natefaubion opened this issue Mar 14, 2016 · 2 comments
Labels
type: enhancement A new feature or addition.

Comments

@natefaubion
Copy link

If either of the arrays are 0-length, then we should return the other as is instead of unnecessarily creating a copy.

@garyb garyb added the type: enhancement A new feature or addition. label Mar 29, 2016
@hdgarrood
Copy link
Contributor

Do we know if JS VMs do this already? (And why not, if not?)

Even if they don't, I think doing this could have a cost for foldMap on large structures. I'd like to see benchmarks first.

@garyb
Copy link
Member

garyb commented Sep 25, 2016

They don't do so, as concat always shallow-copies arrays in JS by design.

Can you explain a bit more about your concern with foldMap? I'm not sure what you're thinking there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Projects
None yet
Development

No branches or pull requests

3 participants