11

I've been using applicative (and alternative) a fair bit lately, and one thing that has been frustrating me is my lack of knowledge of the nomenclature. As an example, I'd like to be able to say function name instead of star thing for <*>. So, in much the same way that >>= is read bind, are there more human-friendly names for the following:

  • <*> - apply?
  • <* & *> - left and right apply?
  • <$> - fmap?
  • <|>

and likewise from arrows

  • *** - split?
  • &&& - fanout?

If there are names for these, my searches haven't uncovered them. I understand that there might not be accepted terms for these, but if there are I'd love to know them.

dave4420
  • 46,404
  • 6
  • 118
  • 152
lukerandall
  • 2,201
  • 17
  • 29
  • 4
    I've already [expressed my opinion at great length](http://stackoverflow.com/questions/3242361/haskell-how-is-pronounced/3242853#3242853) regarding the pronunciation of `(<*>)` so I'll just link to it here instead of repeating myself... – C. A. McCann Apr 29 '11 at 20:03
  • 2
    Agreed with camccann, `<*>` really is "ap" -- though clearly `<$>` is the money function. – Don Stewart Apr 29 '11 at 20:05

3 Answers3

11

The notation comes from Doaitse Swierstra and Luc Duponcheel: they had already identified this interface for parser combinators, and we felt it was important to respect their choices where it was meaningful to do so. I'm trying to remember how Doaitse pronounces them, but drawing a blank.

I prefer them to be seen and not heard. In fact, I prefer them not to be seen either, hence idiom brackets. But especially when defining an instance, it's helpful to have names. Not that it's down to me to name them: the whole Idiom vs Applicative vs goodness-knows-what shenanigans was a fascinating study of power. For what it's worth, in my own parlance

  • <*> is 'applied (to)' (the interface is 'pure and applied', like mathematics)
  • *> is 'ignored'
  • <* is 'ignoring'
  • <$> is 'mapped (over)'
  • <$ is perhaps 'after', but I'm not terribly conscious of calling it anything

The key ideas: the effects always sequence (whatever that means) left-to-right; the $ or * tell you whether what's to their left is pure or idiomatic; the chevrons tell you the resulting dataflow, pointing only to the signal.

An alternative pronunciation scheme, a level away from the individual operators, might translate

f <$> a <*> b <* c <*> d

to 'IDIOM: f, a, b, NOISE c, d' or some such. But that's really reading the bracket version

(|f a b (-c-) d|)

out loud.

I find 'money' and 'splat' amusing, but we might do well to prioritize semantics over asciidents of syntax.

lukerandall
  • 2,201
  • 17
  • 29
Conor
  • 366
  • 2
  • 3
8

Well, <$> is a synonym for fmap. Also, the name "applicative" makes me think of applying things. Since <*> is the main operator for doing that, I think I associate it loosely with the word "apply". The context is slightly different from normal function application so there could be some confusion with that word, but the context usually makes it clear enough, so it works for me. <*> is also a synonym for the ap function from Control.Monad, so this confirms my use of the word "apply".

Brent Yorgey's Typeclassopedia is where I learned most of this. It's an outstanding resource.

mightybyte
  • 7,282
  • 3
  • 23
  • 39
5

Well, there's no standard names, but sometimes they're referred to as:

  • <*> is "splat"
  • <$> is "money"

such that:

 f <$> g <*> x

is pronounced:

 f `money` g `splat` x

Terms originated by Trevor Elliott and Eric Mertens, I believe.

Don Stewart
  • 137,316
  • 36
  • 365
  • 468
  • 9
    It is probably not worth noting that "splat" and "big money" are the official pronunciations specified for the `*` and `$` operators in the original **INTERCAL Reference Manual**, which is most certainly an authoritative source if I've never heard of one. – C. A. McCann Apr 29 '11 at 20:23
  • Thanks, as always, for the helpful answer. It was hard to only accept one. – lukerandall Apr 30 '11 at 14:48
  • I use the poems Waka Waka Bang Splat and Hatless Atlas for inspiration in figuring out how to pronounce things, but for a more comprehensive reference you could use the ASCII Table Pronounciation Guide: http://ascii-table.com/pronunciation-guide.php – aculich Apr 30 '11 at 17:01