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

Remove Num instance for Angle #150

Merged
merged 2 commits into from
Jan 27, 2014
Merged

Remove Num instance for Angle #150

merged 2 commits into from
Jan 27, 2014

Conversation

bergey
Copy link
Member

@bergey bergey commented Jan 27, 2014

I think this should have been part of #140. In that PR I introduced a bunch of bugs which @byorgey had to fix. (abff596, 174f7b4, 10cae4c) With the changes in this PR, such buggy code will not type check.

With the old Angle class, we used the Num instance for the 1/2 :: Turn syntax. We don't need that now, so it leaks the internal representation: rotate (1/2) is the same as rotate (1/2 @@ rad), but we shouldn't ever do that. Multiplication of Angles was always a bad idea.

If this looks good to folks, I'll make the corresponding changes in other packages.

Data.VectorSpace provides correct operators for addition and scalar
multiplication.
Multiplication of angles is meaningless, and allowing numeric literals
as Angles leaks the internal representation.
@byorgey
Copy link
Member

byorgey commented Jan 27, 2014

Looks good to me. Relatedly, there is also the further question of whether we want to make separate Direction and Angle types, with an AffineSpace instance. I am not yet clear on the costs/benefits of that approach. (It would probably need to generalize cleanly to higher dimensions.)

byorgey added a commit that referenced this pull request Jan 27, 2014
Remove Num instance for Angle
@byorgey byorgey merged commit 7c57eac into master Jan 27, 2014
@byorgey byorgey deleted the angle branch January 27, 2014 16:58
@bergey
Copy link
Member Author

bergey commented Jan 27, 2014

Interesting. I'll have to think more about a possible Direction.

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.

None yet

2 participants