
From: "Shae Matijs Erisson - shae@ScannedInAvian.com" Sent: Tuesday, December 06, 2005 6:16 PM
haskell-cafe.mail.zooloo@xoxy.net writes:
being occupied with learning both languages, I'm getting curious if Haskell couldn't achieve most of the performance gains resulting from uniqueness typing in Clean by *automatically* determining the reference count of arguments wherever possible and subsequently allowing them to be physically replaced immediately by (the corresponding part of) the function's result. Are there any principal obstacles, or *could* this be done, or *is* this even done already, e. g. in ghc?
Maybe you're describing speculative evaluation?
Optimistic Evaluation: An Adaptive Evaluation Strategy for Non-Strict Programs http://citeseer.ist.psu.edu/ennals03optimistic.html --
Thanks for the pointer - I have heard a little about optimistic evaluation already, but don't know much of the details (yet). Anyway, from what I know, I think it's a different thing. In Clean, you can (and often are required to) assign uniqueness attributes to some parts of a function's type signature. The extended type checker ensures that none of those parts is referred to more than once during a single run of the program. Based on this guarantee, a function does not have to allocate new memory at all to store a unique result but can overwrite the unique arguments in place. Apparently, the uniqueness assignments have to comply with very tight laws - getting a program through the Clean type checker can be tough, once it reports an uniqueness coercion error. I suppose, no explicit uniqueness attributing is going to be implemented in Haskell, anyway. My question is - and this might better suit to Haskell -, can't uniqueness be inferred (and exploited) automatically in many cases? Regards, zooloo -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/192 - Release Date: 05.12.2005