[Haskell-cafe] Re: Parsers are monadic?

Arie Peterson ariep at xs4all.nl
Mon Jul 2 17:38:41 EDT 2007


Gregory Propf wrote:

> Right, I read more about it and found this out.  The 'main' function is
> apparently magical at runtime and allows you to break the with pure
> functionality just once but since it can call other functions this allows
> for useful programs to be written.

There is more than one way to look at this, but I wouldn't say purity is
broken, not even by the main function.

You can think of an IO action as an 'execution plan', containing detailed
instructions on obtaining input, applying functions, branching, creating
output, etc.

The compiler takes the 'main' execution plan, and creates a program that
will actually perform it.

As a programmer, you only compose execution plans, which is nice and pure.


Kind regards,

Arie



More information about the Haskell-Cafe mailing list