Lazy functors and friends

Max Bolingbroke batterseapower at
Sun Jun 5 17:06:23 CEST 2011

On 5 June 2011 11:28, Henning Thielemann <lemming at> wrote:
> What do you think of it? Are there more laws that would be reasonable?

Jeremy Gibbons articulated a good set of laws, which unfortunately
have not made their way into the documentation. See Section 5 of

Paraphrasing, the laws are:

  1. Identity (as you proposed): sequenceA . fmap Id = Id
  2. Composition: sequenceA . fmap Comp = Comp . fmap sequenceA . sequenceA
  3. Naturality. For "applicative functor transformation" phi, we
have: sequenceA . fmap phi = phi ◦ sequenceA

Where an applicative functor transformation phi :: m a -> n a is a
function that respects:
    a) phi (pure a) = pure a
    b) phi (mf <*> mx) = phi mf <*> phi mx


More information about the Libraries mailing list