From 27aaa66720b04781c723e1affb77a48b6de52e88 Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Sat, 16 Dec 2023 21:52:11 +0000 Subject: [PATCH] more inlining, since ghc9.4 is more agressive. --- Graphics/Implicit/Canon.hs | 1 + Graphics/Implicit/Definitions.hs | 2 ++ Graphics/Implicit/Export/Render/GetLoops.hs | 1 + Graphics/Implicit/ObjectUtil/GetBoxShared.hs | 3 +++ 4 files changed, 7 insertions(+) diff --git a/Graphics/Implicit/Canon.hs b/Graphics/Implicit/Canon.hs index c455a172..71feed18 100644 --- a/Graphics/Implicit/Canon.hs +++ b/Graphics/Implicit/Canon.hs @@ -125,6 +125,7 @@ fmapSharedObj -> (obj -> obj) -> obj -> obj +{-# INLINABLE fmapSharedObj #-} fmapSharedObj _ g (Shared Empty) = g emptySpace fmapSharedObj _ g (Shared Full) = g fullSpace fmapSharedObj f g (Shared (Complement o)) = g $ Shared $ Complement (f o) diff --git a/Graphics/Implicit/Definitions.hs b/Graphics/Implicit/Definitions.hs index 003ebdac..bdfdda95 100644 --- a/Graphics/Implicit/Definitions.hs +++ b/Graphics/Implicit/Definitions.hs @@ -428,10 +428,12 @@ quaternionToEuler (Quaternion w (V3 x y z))= roll = atan2 sinr_cosp cosr_cosp yaw = atan2 siny_cosp cosy_cosp in V3 roll pitch yaw +{-# INLINABLE quaternionToEuler #-} -- | Returns True if any component of a foldable functor is zero hasZeroComponent :: (Foldable f, Num a, Eq a) => f a -> Bool +{-# INLINABLE hasZeroComponent #-} hasZeroComponent = any (==0) diff --git a/Graphics/Implicit/Export/Render/GetLoops.hs b/Graphics/Implicit/Export/Render/GetLoops.hs index 5dc9209c..5f0ca8d0 100644 --- a/Graphics/Implicit/Export/Render/GetLoops.hs +++ b/Graphics/Implicit/Export/Render/GetLoops.hs @@ -42,6 +42,7 @@ getLoops' -> [[a]] -- ^ accumulator -> a -- ^ last element in the accumulator -> Maybe [[[a]]] +{-# INLINABLE getLoops' #-} -- If there aren't any segments, and the "building loop" is empty, produce no loops. getLoops' [] [] _ = Just [] diff --git a/Graphics/Implicit/ObjectUtil/GetBoxShared.hs b/Graphics/Implicit/ObjectUtil/GetBoxShared.hs index 89cbbc6e..bf679465 100644 --- a/Graphics/Implicit/ObjectUtil/GetBoxShared.hs +++ b/Graphics/Implicit/ObjectUtil/GetBoxShared.hs @@ -106,6 +106,7 @@ fullBox = (uniformV (-infty), uniformV infty) pointsBox :: (Applicative f, Num a, VectorStuff (f a)) => [f a] -> (f a, f a) pointsBox [] = emptyBox pointsBox (a : as) = (foldr (pointwise min) a as, foldr (pointwise max) a as) +{-# INLINABLE pointsBox #-} ------------------------------------------------------------------------------ -- | Compute the intersection of dimensionality-polymorphic bounding boxes. @@ -115,6 +116,7 @@ unionBoxes r . pointsBox . foldMap corners . filter (not . isEmpty) +{-# INLINABLE unionBoxes #-} -- | Is a box empty? isEmpty :: (Eq (f a), Applicative f, Num a, Num (f a)) => (f a, f a) -> Bool @@ -130,6 +132,7 @@ getBoxShared . ( Object obj f a, VectorStuff (f a), ComponentWiseMultable (f a), Fractional a, Metric f) => SharedObj obj f a -> (f a, f a) +{-# INLINABLE getBoxShared #-} -- Primitives getBoxShared Empty = emptyBox getBoxShared Full = fullBox