[Haskell-cafe] Tutorial: Haskell for the Evil Genius

Bartosz Milewski bartosz at fpcomplete.com
Sun Oct 14 19:37:40 CEST 2012

I'm afraid this kind of 5-minute talk makes sense only if you already know 
a lot about monads or are a computer scientist; not if you're a programmer 
who wants to learn a new language. For instance, this statement starts 
making sense only if you've seen a lot of examples of monads (maybe even 
read Moggi and Wadler) and want to understand the big picture.

"... when Haskell programmers want to perform a side effect, they 
explicitly construct a description of the side effecting computation as a 

And even then, what does it mean to "construct a description of the side 
effecting computation as a value" for the Maybe monad? An IO action or a 
State Monad action indeed are values that describe computations, but what 
computation does (Just 1) describe? It's the simple monads that are tricky 
to explain (I've seen a discussion to that effect in this forum and I 
wholeheartedly agree). 


On Sunday, September 16, 2012 7:49:51 AM UTC-7, Tillmann Rendel wrote:
> Hi, 
> Kristopher Micinski wrote: 
> > Everyone in the Haskell cafe probably has a secret dream to give the 
> > best "five minute monad talk." 
> (1) Most programming languages support side effects. There are different 
> kinds of side effects such as accessing mutable variables, reading 
> files, running in parallel, raising exceptions, nondeterministically 
> returning more than one answer, and many more. Most languages have some 
> of these effects built into their semantics, and do not support the 
> others at all. 
> (2) Haskell is pure, so it doesn't support any side effects. Instead, 
> when Haskell programmers want to perform a side effect, they explicitly 
> construct a description of the side effecting computation as a value. 
> For every group of related side effects, there is a Haskell type that 
> describes computations that can have that group of side effects. 
> (3) Some of these types are built in, such as IO for accessing the world 
> outside the processor and ST for accessing local mutable variables. 
> Other such types are defined in Haskell libraries, such as for 
> computations that can fail and for computations that can return multiple 
> answers. Application programmers often define their own types for the 
> side effects they need to describe, tailoring the language to their needs. 
> (4) All computation types have a common interface for operations that 
> are independent of the exact side effects performed. Some functions work 
> with arbitrary computations, just using this interface. For example, we 
> can compose a computation with itself in order to run it twice. Such 
> generic operations are highly reusable. 
> (5) The common interface for constructing computations is called 
> "Monad". It is inspired by the mathematical theory that some computer 
> scientists use when they describe what exactly the semantics of a 
> programming language with side effects is. So most other languages 
> support some monad natively without the programmer ever noticing, 
> whereas Haskell programmers can choose (and even implement) exactly the 
> monads they want. This makes Haskell a very good language for side 
> effecting computation. 
>    Tillmann 
> _______________________________________________ 
> Haskell-Cafe mailing list 
> Haskel... at haskell.org <javascript:> 
> http://www.haskell.org/mailman/listinfo/haskell-cafe 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121014/746c4408/attachment-0001.htm>

More information about the Haskell-Cafe mailing list