>> 2b. You can define brand new flow control constructs *inside* the language
>> itself. (E.g., in Java, a "for" loop is a built-in language construct. In
>> Haskell, "for" is a function in Control.Monad. Just a plain ordinary
>> function that anybody could write.)
>>
>
> Psst, heard about Scheme & call/cc?
But, very importantly, purity allows you to *restrict* the flow
constructs that client code has available. If you have continuations
+ mutable state you can do anything, but the more code can *do*, the
less you *know* about it. For example, providing parser combinators
as an applicative functor offers more power than a traditional parser
generator, but not enough that we can no longer parse efficiently.
Exactly my fear over unsafePerformIO in 3rd party Haskell libraries :-).
One can present an interface in Haskell that looks safe, but it can be very unsafe in its implementation.
Dave
Luke