Commits

Belind committed df4b012

Define foldl and foldr for Foldable instance of Node.

  • Participants
  • Parent commits dd35bf8

Comments (0)

Files changed (1)

Data/CritBit/Types/Internal.hs

     fmap _ Empty                = Empty
 
 instance Foldable (Node k) where
+    foldl f z m = foldlWithKey (\a _ v -> f a v) z (CritBit m)
+    foldr f z m = foldrWithKey (\_ v a -> f v a) z (CritBit m)
+
     foldMap f (Internal l r _ _) = mappend (foldMap f l) (foldMap f r)
     foldMap f (Leaf _ v)         = f v
     foldMap _ Empty              = mempty