mapBagM, mapAndUnzipBagM
) where
+#include "Typeable.h"
+
import Outputable
-import Util ( isSingleton )
+import Util
+import Data.Data
import Data.List ( partition )
infixr 3 `consBag`
\begin{code}
instance (Outputable a) => Outputable (Bag a) where
ppr bag = braces (pprWithCommas ppr (bagToList bag))
+
+INSTANCE_TYPEABLE1(Bag,bagTc,"Bag")
+
+instance Data a => Data (Bag a) where
+ gfoldl k z b = z listToBag `k` bagToList b -- traverse abstract type abstractly
+ toConstr _ = abstractConstr $ "Bag("++show (typeOf (undefined::a))++")"
+ gunfold _ _ = error "gunfold"
+ dataTypeOf _ = mkNoRepType "Bag"
\end{code}