Proposal: Add default instances for Functor and Applicative
Bas van Dijk
v.dijk.bas at gmail.com
Sat Sep 24 10:36:19 CEST 2011
On 24 September 2011 09:20, Antoine Latter <aslatter at gmail.com> wrote:
> From what I understand (I haven't tried the extension yet) you would
> still need an instance declaration, even if it had no body:
Yes you would indeed.
While I already said I liked this idea, I do see one complication: as
also explained in the DefaulSuperclassInstances[1] proposal there can
be multiple ways of defining fmap:
default fmap :: Applicative f => (a -> b) -> f a -> f b
fmap = Control.Applicative.liftA
default fmap :: Traversable f => (a -> b) -> f a -> f b
fmap = Data.Traversable.fmapDefault
Which do we choose? I'm happy with liftA but others might disagree.
With regard to [1], is there already a plan to implement them? And if
so, when is it expected to be finished? If it takes some time, this
might be a temporary solution.
Regards,
Bas
[1] http://hackage.haskell.org/trac/ghc/wiki/DefaultSuperclassInstances
More information about the Libraries
mailing list