Add an INLINE pragme for fmapDefault
[ghc-base.git] / Data / Traversable.hs
index 0df8bd4..3d3ae70 100644 (file)
@@ -107,6 +107,7 @@ instance Traversable Maybe where
         traverse f (Just x) = Just <$> f x
 
 instance Traversable [] where
+        {-# INLINE traverse #-} -- so that traverse can fuse
         traverse f = Prelude.foldr cons_f (pure [])
           where cons_f x ys = (:) <$> f x <*> ys
 
@@ -171,6 +172,7 @@ mapAccumR f s t = runStateR (traverse (StateR . flip f) t) s
 
 -- | This function may be used as a value for `fmap` in a `Functor` instance.
 fmapDefault :: Traversable t => (a -> b) -> t a -> t b
+{-# INLINE fmapDefault #-}
 fmapDefault f = getId . traverse (Id . f)
 
 -- | This function may be used as a value for `Data.Foldable.foldMap`