# log-book

## Influential papers

The representation of monads in Haskell is based on the Kleisli triple formulation:

A Kleisli triple over a categroy 𝒞 is a triple (T,η,*), where T : |𝒞| → |𝒞|, ηA : A → TA for A ∈ |𝒞|, f* : TA → TB for f : A → TB and the following equation hold: . . .

In Haskell, 𝒞 is the categroy which Haskell types as objects and Haskell functions as arrows, T corresponds to a parameterised type, η is called return, and * is called >>==

return :: a -> T a
(>>=) :: (a -> T b) -> (T a -> T b)

In Haskell, return is used to wrap data in a monad. When speaking about I/O, return is used to take pure data and bring it into the IO monad.

A useful way to link its behavior to its name is that it injects(returns) a pure value (of type a) into a monad (of type m a).

We can consider >>= to be a currried function of two arguments, with type (a -> T b) and T a.

We give >>= the type

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

Now the metalanguage notation let x ⇐ e1 in e2 can be conveniently expressed as:

e1 >>= \x -> e2
• \x -> e means λxe
• this bind x to the result of e1 in e2;
• >>= pronounced as “bind”
• \x pronounced as “λ x”

This is Anonymous (lambda) function in Haskell. We introduce an anonymous function with a backslash character (\) pronounced lambda. (the backslash was chosen for its visual resemblance to the Greek letter λ.)
Real World Haskell, Chapter 4, Functional Programming, Anonymous (lambda) Functions