Skip to content

Commit

Permalink
Implement bimap as a single foldg
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed Jan 23, 2019
1 parent 45eded9 commit baeafb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Algebra/Graph/Labelled.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ instance (Ord a, Num a, Dioid e) => Num (Graph e a) where

#if MIN_VERSION_base(4,8,0)
instance Bifunctor Graph where
bimap f g = emap f . fmap g
bimap f g = foldg Empty (Vertex . g) (Connect . f)
#endif

-- TODO: This is a very inefficient implementation. Find a way to construct an
Expand Down

0 comments on commit baeafb9

Please sign in to comment.