[Git][ghc/ghc][master] 4 commits: Update documentation for `<**>`

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Jun 17 03:08:13 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
640ea90e by Diego Diverio at 2023-06-16T23:07:55-04:00
Update documentation for `<**>`

- - - - -
2469a813 by Diego Diverio at 2023-06-16T23:07:55-04:00
Update text

- - - - -
1f515bbb by Diego Diverio at 2023-06-16T23:07:55-04:00
Update examples

- - - - -
7af99a0d by Diego Diverio at 2023-06-16T23:07:55-04:00
Update documentation to actually display code correctly

- - - - -


1 changed file:

- libraries/base/GHC/Base.hs


Changes:

=====================================
libraries/base/GHC/Base.hs
=====================================
@@ -806,11 +806,21 @@ class Functor f => Applicative f where
     (<*) :: f a -> f b -> f a
     (<*) = liftA2 const
 
--- | A variant of '<*>' with the arguments reversed.
+-- | A variant of '<*>' with the types of the arguments reversed. It differs from
+-- @`flip` `(<*>)`@ in that the effects are resolved in the order the arguments are
+-- presented.
 --
+-- ==== __Examples__
+-- >>> (<**>) (print 1) (id <$ print 2)
+-- 1
+-- 2
+--
+-- >>> flip (<*>) (print 1) (id <$ print 2)
+-- 2
+-- 1
+
 (<**>) :: Applicative f => f a -> f (a -> b) -> f b
 (<**>) = liftA2 (\a f -> f a)
--- Don't use $ here, see the note at the top of the page
 
 -- | Lift a function to actions.
 -- Equivalent to Functor's `fmap` but implemented using only `Applicative`'s methods:



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0baf9e7cfa5d0e76998c2a528693736a6317cf4c...7af99a0d2aac4a6caca73d7470c94881651457a2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0baf9e7cfa5d0e76998c2a528693736a6317cf4c...7af99a0d2aac4a6caca73d7470c94881651457a2
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230616/00542c9d/attachment-0001.html>


More information about the ghc-commits mailing list