Skip to content

Commit

Permalink
Define emap in terms of bimap where available
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed Jan 23, 2019
1 parent baeafb9 commit bd0043a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Algebra/Graph/Labelled.hs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,12 @@ transpose = foldg empty vertex (fmap flip connect)
-- emap g . emap h == emap (g . h)
-- @
emap :: (e -> f) -> Graph e a -> Graph f a
emap f = foldg Empty Vertex (Connect . f)
emap f =
#if MIN_VERSION_base(4,8,0)
first f
#else
foldg Empty Vertex (Connect . f)
#endif

-- | Construct the /induced subgraph/ of a given graph by removing the
-- vertices that do not satisfy a given predicate.
Expand Down

0 comments on commit bd0043a

Please sign in to comment.