
Fair enough, it should just be a matter of writing a patch then.
The general resolution to adopt these sorts of "obvious"
only-one-way-to-do-it instances is already in place.
https://ghc.haskell.org/trac/ghc/ticket/8797
https://mail.haskell.org/pipermail/libraries/2014-June/023229.html
https://ghc.haskell.org/trac/ghc/ticket/9043#comment:23
etc.
At some point during 7.12 we'll need to go through and do an audit to see
which ones are still missing.
-Edward
On Sun, Feb 22, 2015 at 3:04 AM, Oleg Grenrus
Based on http://git.haskell.org/ghc.git/blob/refs/heads/ghc-7.10:/libraries/base/Data... only First and Last have Functor, Applicative and Monad; Foldable, Traversable and Data are missing.
On 22 Feb 2015, at 09:56, Edward Kmett
wrote: Many instances for data types in Data.Monoid have already been added in 7.10.
Are these still missing?
-Edward
On Sat, Feb 21, 2015 at 10:34 AM, Oleg Grenrus
wrote: I propose to add Functor, Applicative, Monad, Foldable, and Traversable and maybe even MonadFix instances to wrapper newtypes in the Data.Monoid module. The same way as in the semigroups package, e.g. https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.ht... < https://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-Semigroup.ht...
Basically:
instance Functor Sum where fmap f (Sum x) = Sum (f x)
instance Foldable Sum where foldMap f (Sum a) = f a
instance Traversable Sum where traverse f (Sum a) = Sum <$> f a
instance Applicative Sum where pure = Sum a <* _ = a _ *> a = a Sum f <*> Sum x = Sum (f x)
instance Monad Sum where return = Sum _ >> a = a Sum a >>= f = f a
instance MonadFix Sum where mfix f = fix (f . getSum)
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries