Proposal: Add Foldable and Traversable instances for ((,) a)
Ross Paterson
ross at soi.city.ac.uk
Tue Jun 23 08:25:27 EDT 2009
On Tue, Jun 23, 2009 at 03:07:04PM +0300, Yitzchak Gale wrote:
> The other amendment is to fix the documentation
> for the functions fmapDefault and foldMapDefault
> in Data.Traversable. Contrary to what is stated,
> these cannot be used as methods in superclasses,
> since the superclasses must already exist before
> these functions can be defined. Instead, I have
> paraphrased what is stated in the documentation
> above: that the corresponding superclass methods
> should be equivalent to these.
The intention is that if you only want to define Traversable, you can
fill in the required superclass instances by defining
instance Functor F where
fmap = fmapDefault
instance Foldable F where
foldMap = foldMapDefault
instance Traversable F where
traverse = ...
That should work fine. However the fmap definition won't work if you
defined sequenceA instead of traverse, so the documentation of fmapDefault
needs to be corrected to say that.
More information about the Libraries
mailing list