Andreas Abel wrote:

> I tell them that monads are for sequencing effects; and the

> sequencing is visible clearly in

>

> (>>) :: IO a -> IO b -> IO b

> (>>=) :: IO a -> (a -> IO b) -> IO b

>

> but not in

>

> fmap :: (a -> b) -> IO a -> IO b

> join :: IO (IO a) -> IO a

Indeed! I'd like to point out an old academic paper that was written

exactly on the subject at hand: how Category Theory monads relate to

monads in Haskell. Here is the relevant quotation:

Monads are typically equated with single-threadedness, and are

therefore used as a technique for incorporating imperative features

into a purely functional language. Category theory monads have little

to do with single-threadedness; it is the sequencing imposed by

composition that ensures single-threadedness. In a Wadler-ised monad

this is a consequence of bundling the Kleisli star and flipped compose

into the bind operator. There is nothing new in this connection. Peter

Landin in his Algol 60 used functional composition to model

semi-colon. Semi-colon can be thought of as a state transforming

operator that threads the state of the machine throughout a program.

The work of Peyton-Jones and Wadler has turned full circle back to

Landin's earlier work as their use of Moggi's sequencing monad enables

real side-effects to be incorporated into monad operations such as

print.

Quoted from: Sec 3: An historical aside

Jonathan M. D. Hill and Keith Clarke:

An Introduction to Category Theory, Category Theory Monads,

and Their Relationship to Functional Programming. 1994.

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.6497I'd like to stress: the single-threadedness, the trick that lets us

embed imperative language into a pure one, has *little to do* with

category-theoretic monads with their Klesli star.

The web page

http://okmij.org/ftp/Computation/IO-monad-history.htmldescribes the work of Landin in detail, contrasting Landin's and

Peyton-Jones' papers.

_______________________________________________

Haskell-Cafe mailing list

[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe