<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">D is already implemented:<div class=""><br class=""></div><div class=""><a href="https://phabricator.haskell.org/rGHC1f60d635cee1ff3db72e0129f9035b147f52c9c4" class="">https://phabricator.haskell.org/rGHC1f60d635cee1ff3db72e0129f9035b147f52c9c4</a></div><div class=""><a href="https://ghc.haskell.org/trac/ghc/ticket/9664" class="">https://ghc.haskell.org/trac/ghc/ticket/9664</a></div><div class=""><br class=""></div><div class="">Seems it just (~30 hours ago) landed the 7.10 branch <a href="https://git.haskell.org/ghc.git/blob/refs/heads/ghc-7.10:/libraries/base/Data/Functor/Identity.hs" class="">https://git.haskell.org/ghc.git/blob/refs/heads/ghc-7.10:/libraries/base/Data/Functor/Identity.hs</a></div><div class=""><br class=""></div><div class="">So, it’s only A, B, C options in discussion anymore.</div><div class=""><br class=""></div><div class="">- Oleg</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 22 Feb 2015, at 12:07, Oleg Grenrus <<a href="mailto:oleg.grenrus@iki.fi" class="">oleg.grenrus@iki.fi</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">To clarify the discussion:<br class=""><br class="">Let's add the following instances:<br class=""><br class="">A: Functor, Foldable, Traversable to Sum, Product, Dual, First, and Last<br class="">B: Data to everything in Data.Monoid (except Endo): Sum, Product, Dual, First and Last, All, Any, Alt<br class="">C: Applicative, Monad, MonadFix to Sum, Product, Dual, First and Last<br class="">D: Data to Identity<br class=""><br class="">All seem to agree on A and B, C is "not sure", and D is new item.<br class=""><br class="">- Oleg<br class=""><br class=""><blockquote type="cite" class="">On 21 Feb 2015, at 17:34, Oleg Grenrus <<a href="mailto:oleg.grenrus@iki.fi" class="">oleg.grenrus@iki.fi</a>> wrote:<br class=""><br class="">I propose to add Functor, Applicative, Monad, Foldable, and Traversable and maybe even MonadFix instances to wrapper newtypes in the Data.Monoid module.<br class="">The same way as in the semigroups package, e.g. <a href="https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min" class="">https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min</a> <<a href="https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min" class="">https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.html#t:Min</a>><br class=""><br class="">Basically:<br class=""><br class="">instance Functor Sum where<br class=""> fmap f (Sum x) = Sum (f x)<br class=""><br class="">instance Foldable Sum where<br class=""> foldMap f (Sum a) = f a<br class=""><br class="">instance Traversable Sum where<br class=""> traverse f (Sum a) = Sum <$> f a<br class=""><br class="">instance Applicative Sum where<br class=""> pure = Sum<br class=""> a <* _ = a<br class=""> _ *> a = a<br class=""> Sum f <*> Sum x = Sum (f x)<br class=""><br class="">instance Monad Sum where<br class=""> return = Sum<br class=""> _ >> a = a<br class=""> Sum a >>= f = f a<br class=""><br class="">instance MonadFix Sum where<br class=""> mfix f = fix (f . getSum)<br class="">_______________________________________________<br class="">Libraries mailing list<br class=""><a href="mailto:Libraries@haskell.org" class="">Libraries@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries<br class=""></blockquote><br class="">_______________________________________________<br class="">Libraries mailing list<br class=""><a href="mailto:Libraries@haskell.org" class="">Libraries@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries<br class=""></div></blockquote></div><br class=""></div></body></html>