Applicative ((->) c) methods

Keith keith.wygant at gmail.com
Mon Nov 18 20:40:13 UTC 2019


Just thinking for Applicative ((->) c)
  (<*) = const
  (*>) = flip const -- or \ _ x -> x

Is it because we can rely on GHC to produce the same code from the current definitions?


Also wondering why Monad uses 
  f >>= k = \ r -> k (f r) r

but Applicative uses
  (<*>) f g x = f x (g x)
  liftA2 q f g x = q (f x) (g x)

Seems like if it's style/legibility, it should be consistent between (>>=) and (<*>). And if it's inlining issue, we'd want lambdas for all three.

--Keith
-- 
Sent from my phone with K-9 Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191118/99936f05/attachment.html>


More information about the Libraries mailing list