[Haskell-cafe] Re: Can we come out of a monad?

Tillmann Rendel rendel at Mathematik.Uni-Marburg.de
Wed Aug 11 15:13:56 EDT 2010


Dan Doel wrote:
> But, to get back 
> to BASIC, or C, if the language you're extending is an empty language that 
> does nothing, then remaining pure to it isn't interesting. I can't actually 
> write significant portions of my program in such a language, so all I'm left 
> with is the DSL, which doesn't (internally) have the nice properties.

I understand your argument to be the following: Functional languages are 
built upon the lambda calculus, so a *pure* functional language has to 
preserve the equational theory of the lambda calculus, including, for 
example, beta reduction. But since BASIC or C are not built upon any 
formal calculus with an equational theory, there is not notion of purity 
for these languages.

I like your definition of purity, but I disagree with respect to your 
evaluation of BASIC and C. To me, they seem to be built upon the formal 
language of arithmetic expressions, so they should, to be "pure 
arithmetic expression languages", adhere to such equations as the 
commutative law for integers.

   forall x y : integer, x + y = y + x

But due to possible side effects of x and y, languages like BASIC and C 
do not adhere to this, and many other laws. I would therefore consider 
them impure. They could be more pure by allowing side effects only in 
statements, but not in expressions.

   Tillmann


More information about the Haskell-Cafe mailing list