Skip to content

Confusing documentation of <**>

Summary

Location of documentation issue: the Haddocks of base

The Haddock documentation of (<**>) is very brief, it simply says:

A variant of '<*>' with the arguments reversed.

For me this is too brief. It makes it sound like (<**>) = flip (<*>), which is not true for all applicatives, e.g.:

ghci> (<**>)       (print 1) (id <$ print 2)
1
2
ghci> (flip (<*>)) (print 1) (id <$ print 2)
2
1

Proposed improvements or changes

I would like to see a mention of the fact that the effects of the first argument are still performed before the effects of the second argument.

Environment

  • GHC version used (if appropriate): 8.10.7

P.S.

The source code contains this comment below the definition of <**>:

-- Don't use $ here, see the note at the top of the page

But I can't find that note (I looked at the top of the file and searched for $, I assume the note should at least contain that character).

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