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

Rustom Mody rustompmody at gmail.com
Sat Oct 13 20:41:08 CEST 2012


On Sun, Sep 16, 2012 at 8:18 PM, Tillmann Rendel <
rendel at informatik.uni-marburg.de> 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
> <http://blog.languager.org>
>


Very nice! Except that perhaps I'd rewrite the last line as:

...makes Haskell a good language for playing with alternative paradigms of
side-effecting computation

though mine is not as pithy as yours!

Rusi

http://blog.languager.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121014/7b01237d/attachment.htm>


More information about the Haskell-Cafe mailing list