Skip to content

Commit

Permalink
Add INLINE pragmas for hasEdgeP and hasVertexP
Browse files Browse the repository at this point in the history
Thanks Alexandre Moine!
  • Loading branch information
jmtd committed Oct 30, 2018
1 parent 38763fd commit 820798f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Algebra/Graph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ size = foldg 1 (const 1) (+) (+)
-- | Check if a graph contains a vertex which satisfied the supplied predicate.
-- Complexity: /O(s)/ time.
--
{-# INLINE [1] hasVertexP #-}
hasVertexP :: (a -> Bool) -> Graph a -> Bool
hasVertexP pred = foldg False pred (||) (||)

Expand All @@ -495,6 +496,7 @@ hasVertex x = hasVertexP (==x)
-- predicates.
-- Complexity: /O(s)/ time.
--
{-# INLINE [1] hasEdgeP #-}
hasEdgeP :: (a -> Bool) -> (a -> Bool) -> Graph a -> Bool
hasEdgeP predFrom predTo g = hit g == Edge
where
Expand Down

0 comments on commit 820798f

Please sign in to comment.