Skip to content

Commit

Permalink
Merge pull request #460 from Haskell-Things/more_inlines
Browse files Browse the repository at this point in the history
more inlining, since ghc9.4 is more agressive.
  • Loading branch information
julialongtin authored Dec 17, 2023
2 parents 237c027 + 27aaa66 commit 0fd2de4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Graphics/Implicit/Canon.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Graphics/Implicit/Definitions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions Graphics/Implicit/Export/Render/GetLoops.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
Expand Down
3 changes: 3 additions & 0 deletions Graphics/Implicit/ObjectUtil/GetBoxShared.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0fd2de4

Please sign in to comment.