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

Reimplement R2 and R3 as V2 and V3 #342

Merged
merged 8 commits into from
Dec 8, 2020
Merged

Reimplement R2 and R3 as V2 and V3 #342

merged 8 commits into from
Dec 8, 2020

Conversation

isovector
Copy link
Contributor

@isovector isovector commented Dec 6, 2020

This PR replaces R2 and R3 with V2 R and V3 R respectively. There are some major benefits from this:

  • These are proper numeric types and don't require the terrifying orphan instances from ImplicitCad imports orphan num instances #292
  • These are proper functor types, meaning we can eliminate a good chunk of helper functions --- things like both, allthree, CompontwiseMultiplable, and in a follow-up PR, VectorStuff.
  • These are strict types, meaning they are much better at preventing the usual Haskell memory leaks.

In addition, these vector types are well supported by the linear library, which in the future should allow us to simplify a good chunk of the math in this library and delegate it to linear.

NOTE I expected this to be a no-op change, but it has caused three of the golden tests to fail. They are visible indistinguishable, but it's still a little disconcerting. I've looked through the diff three times and can't spot the culprit.

Fixes #286
Fixes #292

@isovector isovector changed the title [wip] use the linear lib Reimplement R2 and R3 as V2 and V3 Dec 7, 2020
@isovector isovector marked this pull request as ready for review December 7, 2020 00:26
@julialongtin
Copy link
Member

ok, this is 'major release bump' territory. it completely blows up hslice, too. :)

@isovector
Copy link
Contributor Author

I realized this morning we can add a typeclass class IsVector from to for converting from the old tuple representations to the new vector ones. That will prevent the public interface from changing at least.

How does this blow up hslice?

@julialongtin julialongtin merged commit d39bd9a into Haskell-Things:master Dec 8, 2020
@isovector isovector deleted the linear branch December 29, 2020 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImplicitCad imports orphan num instances Introduce a vector type
2 participants