From: Michael Orlitzky Date: Tue, 5 Mar 2019 00:44:22 +0000 (-0500) Subject: src/Grid.hs: add type annotations to avoid monomorphism warnings. X-Git-Tag: 1.0.1~48 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=c548fc59fb4856b81a5f205f1963c85e7619871e;p=spline3.git src/Grid.hs: add type annotations to avoid monomorphism warnings. --- diff --git a/src/Grid.hs b/src/Grid.hs index 761fdce..cf5483b 100644 --- a/src/Grid.hs +++ b/src/Grid.hs @@ -77,7 +77,7 @@ cube_at !g !i !j !k = where fvs = function_values g fvs' = make_values fvs i j k - tet_vol = 1/24 + tet_vol = (1/24) :: Double -- The first cube along any axis covers (-1/2, 1/2). The second @@ -96,7 +96,7 @@ calculate_containing_cube_coordinate g coord | otherwise = (ceiling (coord + offset)) - 1 where (xsize, ysize, zsize) = dims (function_values g) - offset = 1/2 + offset = (1/2) :: Double -- | Takes a 'Grid', and returns a 'Cube' containing the given 'Point'. @@ -121,7 +121,7 @@ zoom_result v3d (sfx, sfy, sfz) (Z :. m :. n :. o) = f p where g = Grid v3d - offset = 1/2 + offset = (1/2) :: Double m' = (fromIntegral m) / (fromIntegral sfx) - offset n' = (fromIntegral n) / (fromIntegral sfy) - offset o' = (fromIntegral o) / (fromIntegral sfz) - offset @@ -296,9 +296,9 @@ test_trilinear_reproduced = c0 <- cs, t <- tetrahedra c0, let p = polynomial t, - let i' = fromIntegral i, - let j' = fromIntegral j, - let k' = fromIntegral k] + let i' = fromIntegral i :: Double, + let j' = fromIntegral j :: Double, + let k' = fromIntegral k :: Double] where g = Grid trilinear cs = [ cube_at g ci cj ck | ci <- [0..2], cj <- [0..2], ck <- [0..2] ] @@ -311,9 +311,9 @@ test_zeros_reproduced = | i <- [0..2], j <- [0..2], k <- [0..2], - let i' = fromIntegral i, - let j' = fromIntegral j, - let k' = fromIntegral k, + let i' = fromIntegral i :: Double, + let j' = fromIntegral j :: Double, + let k' = fromIntegral k :: Double, c0 <- cs, t0 <- tetrahedra c0, let p = polynomial t0 ] @@ -332,9 +332,9 @@ test_trilinear9x9x9_reproduced = k <- [0..8], t <- tetrahedra c0, let p = polynomial t, - let i' = (fromIntegral i) * 0.5, - let j' = (fromIntegral j) * 0.5, - let k' = (fromIntegral k) * 0.5] + let i' = (fromIntegral i) * 0.5 :: Double, + let j' = (fromIntegral j) * 0.5 :: Double, + let k' = (fromIntegral k) * 0.5 :: Double] where g = Grid trilinear c0 = cube_at g 1 1 1 @@ -344,12 +344,12 @@ test_trilinear9x9x9_reproduced = prop_cube_indices_never_go_out_of_bounds :: Grid -> Gen Bool prop_cube_indices_never_go_out_of_bounds g = do - let coordmin = negate (1/2) + let coordmin = negate (1/2) :: Double let (xsize, ysize, zsize) = dims $ function_values g - let xmax = (fromIntegral xsize) - (1/2) - let ymax = (fromIntegral ysize) - (1/2) - let zmax = (fromIntegral zsize) - (1/2) + let xmax = (fromIntegral xsize) - (1/2) :: Double + let ymax = (fromIntegral ysize) - (1/2) :: Double + let zmax = (fromIntegral zsize) - (1/2) :: Double x <- choose (coordmin, xmax) y <- choose (coordmin, ymax)