Add explicit foldMap implementation for Maybe
authorDavid Feuer <david.feuer@gmail.com>
Thu, 19 Jan 2017 21:40:06 +0000 (16:40 -0500)
committerDavid Feuer <David.Feuer@gmail.com>
Thu, 19 Jan 2017 21:40:07 +0000 (16:40 -0500)
commitbf1e1f3206f8b274c3ffa33cd7688a0b17eabd0b
tree03cc00a67018231e734073fc0caff206fa6e22c9
parentf07a6c17a3d6b32cc64b0b8318a05177fc098630
Add explicit foldMap implementation for Maybe

Eric Mertens pointed out that using the default `foldMap`
implementation for `Maybe` led to an efficiency problem by
implementing `foldMap f (Just x)` as `f x <> mempty` rather than
as `f x`. This should solve the problem.

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: glguy, thomie

Differential Revision: https://phabricator.haskell.org/D2988
libraries/base/Data/Foldable.hs