X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FTraversable.hs;h=3d3ae70eff395b5e8d55f3785457434c791d2aa5;hb=b99920eab7fba4e027fd39985840d4e854b8f923;hp=0df8bd4c0c5c87322d2f939c41b3b5c72615646a;hpb=dbe9d53f7f98fb0de5d6d8d8c83c496a119f8653;p=ghc-base.git diff --git a/Data/Traversable.hs b/Data/Traversable.hs index 0df8bd4..3d3ae70 100644 --- a/Data/Traversable.hs +++ b/Data/Traversable.hs @@ -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`