Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the etymology of <*> from Applicative in Haskell?

Where did the name <*> first begin to appear in literature or code, and did it come with any explanation for the choice of symbol?

like image 593
Chris Martin Avatar asked Mar 18 '16 08:03

Chris Martin


People also ask

What is applicative in Haskell?

In Haskell, an applicative is a parametrized type that we think of as being a container for data of that type plus two methods pure and <*> . Consider a parametrized type f a . The pure method for an applicative of type f has type. pure :: a -> f a. and can be thought of as bringing values into the applicative.

What is a functor in Haskell?

Functor in Haskell is a kind of functional representation of different Types which can be mapped over. It is a high level concept of implementing polymorphism. According to Haskell developers, all the Types such as List, Map, Tree, etc. are the instance of the Haskell Functor.

What does >> mean in Haskell?

Essentially, a >> b can be read like "do a then do b , and return the result of b ". It's similar to the more common bind operator >>= .

Is maybe a functor Haskell?

Another simple example of a functor is the Maybe type. This object can contain a value of a particular type as Just , or it is Nothing (like a null value).


2 Answers

It's an ASCIIification of the notation used in the original idioms paper: "Idioms: applicative programming with effects". That notation, was in turn, inspired by an already ASCIIified version from Sweirstra's and Duponcheel's paper on error-correcting parser combinators: "Deterministic, Error-Correcting Combinator Parsers". That came from "Functional Parsers" by Jeroen Fokker. This paper does not indicate where it came from which may mean it originated it. I would not be surprised if it was used for parsing before then.

like image 174
Derek Elkins left SE Avatar answered Sep 23 '22 05:09

Derek Elkins left SE


The original idioms paper already uses for application; <*> was picked as an ASCII-art approximation of that, since (*) isn't available (it is the syntax of the prefix form of the infix operator *).

like image 33
Cactus Avatar answered Sep 25 '22 05:09

Cactus