Monads are an idiom, but Idiom isn't a monad

Functional Pearl: Applicative programming with effects, Conor McBride and Ross Patterson

In this paper, we introduce Applicative functors—an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this paper, introducing the applicative pattern by diverse examples, then abstracting it to define the Applicative type class and introducing a bracket notation which interprets the normal application syntax in the idiom of an Applicative functor. Further, we develop the properties of applicative functors and the generic operations they support. We close by identifying the categorical structure of applicative functors and examining their relationship both with Monads and with Arrows.

A well written introduciton to a monad cousin, with a tantilizing hint that idioms are easier to introduce into Haskell syntax:

Given Haskell extended with multi-parameter type classes, enthusiasts for overloading may replace [[ and ]] by identifiers iI and Ii with the right behaviour3.

3 Hint: Define an overloaded function applicative u v1 . . . vn Ii = u (*) v1 ... (*) vn

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I guess it's time you signed

I guess it's time you signed up as editor Jim...

Implementation in Haskell

Coincidentally, and proof that it's fun to watch the Haskell CVS log: Idioms in Haskell