correction of the documentation for Traversable

Petr Pudlák petr.mvd at gmail.com
Tue Apr 9 10:00:56 CEST 2013


Dear haskellers,

I propose a correction to the documentation for Traversable. Currently it
says:

  Minimal complete definition: traverse or sequenceA.

This is not (completely) correct, it should be:

  Minimal complete definition:
    - traverse or
    - sequenceA with fmap.

What happened to me: I defined a Traversable instance with just sequenceA
and used fmapDefault and foldMapDefault to define instances of Functor and
Foldable. This resulted in an infinite loop. This is because traverse is
defined using sequenceA and fmap, but fmapDefault is defined using
traverse. So it's not enough to define sequenceA and use the default
implementations for the rest, one also has to define fmap explicitly.

    With best regards,
    Petr Pudlak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130409/6454fb66/attachment.htm>


More information about the Libraries mailing list