Skip to content

Bifunctor superclass doesn't require second = fmap

The commit message for d87f28d8 states that

Make Functor a quantified superclass of Bifunctor.
    
    See https://github.com/haskell/core-libraries-committee/issues/91 for
    discussion.
    
    This change relates Bifunctor with Functor by requiring second = fmap.
    Moreover this change is a step towards unblocking the major version bump
    of bifunctors and profunctors to major version 6. This paves the way to
    move the Profunctor class into base. For that Functor first similarly
    becomes a superclass of Profunctor in the new major version 6.

but actually there is no requirement that second = fmap and this comment explains why it's problematic due to laziness of existing instances.. https://github.com/haskell/core-libraries-committee/issues/91#issuecomment-1256716483

In fact, the documentation for Bifunctor also claims:

 A partially applied 'Bifunctor' must be a 'Functor' and the 'second' method must agree with 'fmap'.

but like explained in that comment it doesn't apply to the tuple instances.

This needs to recorded in a Note, which explains what the problem is and why the law is not expected to hold.

cc @treeowl

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information