]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Point.hs
spline3.cabal: bump version to 1.0.2
[spline3.git] / src / Point.hs
index 0e29d596e583786c99ca16e7a2922db4a616fdef..d8b8dd858fba42d443a61069437484278b0ceb3a 100644 (file)
@@ -6,7 +6,7 @@ module Point (
   scale )
 where
 
-import Test.QuickCheck ( Arbitrary(..) )
+import Test.Tasty.QuickCheck ( Arbitrary( arbitrary ) )
 
 
 -- | Represents a point in three dimensions. We use a custom type (as
@@ -24,7 +24,7 @@ instance Arbitrary Point where
 
 
 instance Num Point where
-  (Point x1 y1 z1) + (Point x2 y2 z2) = Point (x1+x2) (y1+y2) (z1+z2)
+  (Point x1 y1 z1) + (Point x2 y2 z2) = Point (x1 + x2) (y1 + y2) (z1 + z2)
   (Point x1 y1 z1) - (Point x2 y2 z2) = Point (x1-x2) (y1-y2) (z1-z2)
   (Point x1 y1 z1) * (Point x2 y2 z2) = Point (x1*x2) (y1*y2) (z1*z2)
   abs (Point x y z) = Point (abs x) (abs y) (abs z)
@@ -32,7 +32,7 @@ instance Num Point where
   fromInteger n =
     Point coord coord coord
     where
-      coord = fromInteger n
+      coord = fromInteger n :: Double
 
 
 -- | Scale a point by a constant.
@@ -44,4 +44,4 @@ scale (Point x y z) d = Point (x*d) (y*d) (z*d)
 {-# INLINE dot #-}
 dot :: Point -> Point -> Double
 dot (Point x1 y1 z1) (Point x2 y2 z2) =
-    (x2 - x1)^(2::Int) + (y2 - y1)^(2::Int) + (z2 - z1)^(2::Int)
+    (x2 - x1) ^ (2::Int) + (y2 - y1) ^ (2::Int) + (z2 - z1) ^ (2::Int)