Skip to content

Commit

Permalink
fix a few GHC 9.8 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Feb 12, 2024
1 parent 0599c70 commit 2954c33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/Diagrams/CubicSpline/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ solveCubicSplineDerivativesClosed xs = solveCyclicTriDiagonal as bs as ds 1 1
solveCubicSplineCoefficients :: Fractional a => Bool -> [a] -> [[a]]
solveCubicSplineCoefficients closed xs =
[ [x,d,3*(x1-x)-2*d-d1,2*(x-x1)+d+d1]
| (x,x1,d,d1) <- zip4 xs' (tail xs') ds' (tail ds')
| (x,x1,d,d1) <- zip4 xs' (drop 1 xs') ds' (drop 1 ds')
]
where
ds | closed = solveCubicSplineDerivativesClosed xs
| otherwise = solveCubicSplineDerivatives xs
close as | closed = as ++ [head as]
| otherwise = as
close [] = []
close as@(a:_)
| closed = as ++ [a]
| otherwise = as
xs' = close xs
ds' = close ds
10 changes: 5 additions & 5 deletions src/Diagrams/TwoD/Points.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ import Linear.Affine

-- | Find the convex hull of a list of points using Andrew's monotone chain
-- algorithm O(n log n).
--
--
-- Returns clockwise list of points starting from the left-most point.
convexHull2D :: OrderedField n => [P2 n] -> [P2 n]
convexHull2D ps = init upper ++ reverse (tail lower)
convexHull2D ps = init upper ++ reverse (drop 1 lower)
where
(upper, lower) = sortedConvexHull (sort ps)

-- | Find the convex hull of a set of points already sorted in the x direction.
-- The first list of the tuple is the upper hull going clockwise from
-- left-most to right-most point. The second is the lower hull from
-- | Find the convex hull of a set of points already sorted in the x direction.
-- The first list of the tuple is the upper hull going clockwise from
-- left-most to right-most point. The second is the lower hull from
-- right-most to left-most in the anti-clockwise direction.
sortedConvexHull :: OrderedField n => [P2 n] -> ([P2 n], [P2 n])
sortedConvexHull ps = (chain True ps, chain False ps)
Expand Down

0 comments on commit 2954c33

Please sign in to comment.