[commit: ghc] master: Bag: Add Foldable instance (0d0e651)
git at git.haskell.org
git at git.haskell.org
Fri Aug 21 14:24:49 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/0d0e651d789a9a1b62139a210f4b013fa5453cfa/ghc
>---------------------------------------------------------------
commit 0d0e651d789a9a1b62139a210f4b013fa5453cfa
Author: Ben Gamari <ben at smart-cactus.org>
Date: Tue Aug 18 19:17:50 2015 +0200
Bag: Add Foldable instance
>---------------------------------------------------------------
0d0e651d789a9a1b62139a210f4b013fa5453cfa
compiler/utils/Bag.hs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compiler/utils/Bag.hs b/compiler/utils/Bag.hs
index 8fbfa13..09fc00a 100644
--- a/compiler/utils/Bag.hs
+++ b/compiler/utils/Bag.hs
@@ -29,6 +29,7 @@ import Util
import MonadUtils
import Data.Data
import Data.List ( partition )
+import qualified Data.Foldable as Foldable
infixr 3 `consBag`
infixl 3 `snocBag`
@@ -269,3 +270,6 @@ instance Data a => Data (Bag a) where
gunfold _ _ = error "gunfold"
dataTypeOf _ = mkNoRepType "Bag"
dataCast1 x = gcast1 x
+
+instance Foldable.Foldable Bag where
+ foldr = foldrBag
More information about the ghc-commits
mailing list