[Haskell-cafe] Why purely in haskell?

Stefan Holdermans stefan at cs.uu.nl
Thu Jan 10 12:12:46 EST 2008


Neil wrote:

> Laziness. It is very difficult to have a lazy language which is not  
> pure.

Exactly.

> Laziness and purity together help with equational reasoning, compiler
> transformations, less obscure bugs, better compositionality etc.

Related, but nevertheless a shameless plug: Jurriaan Hage and myself  
did some thinking about this lately and put some stuff on paper that I  
presented two days ago at PEPM [1].

Here's a quote, taken from the introduction:

   "Functional programming languages can be classified along several  
axes: we can distinguish between pure and impure langauges as well as  
between langauges with strict and nonstrict semantics. In practice,  
not all combinations make sense. Nonstrict languages better be pure,  
because reasoning about unrestricted side-effects becomes more  
complicated when the order of evaluation gets less predictable."
   "Purity has some clear advantages. For example, it enables  
equational reasoning and it opens the road to memoization, common  
subexpression elimination, and parallel evaluation strategies. The  
driving force that enables these opportunities is referential  
transparency: in a pure language, each of a program's terms can, at  
any time, be replaced by its value without changing the meaning of the  
program as a whole."

Cheers,

   Stefan

-----
[1] Jurriaan Hage and Stefan Holdermans. Heap recycling for lazy  
languages. In John Hatcliff, Robert Glück, and Oege de Moor, editors,  
_Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation  
and Semantics-Based Program Manipulation_, PEPM'08, San Francisco,  
California, USA, January 7--8, 2008, pages 189--197. ACM Press, 2008. http://doi.acm.org/10.1145/1328408.1328436 
.


More information about the Haskell-Cafe mailing list