Re: [Haskell-cafe] Hughes' parallel annotations for fixing a space leak

2010-04-04 Thread Max Bolingbroke
On 31 March 2010 20:51, Heinrich Apfelmus apfel...@quantentunnel.de wrote:
 As I understand it, GHC implements the technique from Sparud's paper, so
 this is a solved problem.

This is not my understanding. As far as I know, the STG machine has a
special notion of selector thunks, which represent projections from
product data types. These selector thunks are evaluated by the GHC
garbage collector in the manner proposed by Wadler.

The Sparud solution is IMHO much cleaner, though!

Unfortunately I also have no idea where to obtain a copy of Hughes'
thesis The Design and Implementation of Programming Languages.

Cheers,
Max
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hughes' parallel annotations for fixing a space leak

2010-04-04 Thread Leon Smith
On Wed, Mar 31, 2010 at 3:51 PM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
 which were introduced by John Hughes in his Phd thesis from 1983. They
 are intriguing! Unfortunately, I haven't been able to procure a copy of
 Hughes' thesis, either electronic or in paper. :( Can anyone help? Are
 there any other resources about this parallel approach?

Aye,  returning lazy pairs is one of those things that seems rather
magical in several respects.   Out of curiousity,  have you looked at
the unsafePerformIO thought experiment near the end of my Monad Reader
article?   It demonstrates that returning lazy pairs can introduce
multiple code paths through a single function,  reminiscent of (but
different than) multi-mode logical relations.   (Mercury, for example,
 optimizes relations differently depending on their mode.)

I too am interested in looking at Hughes' thesis,  I tried tracking it
down early last year with little success.

Best,
Leon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Hughes' parallel annotations for fixing a space leak

2010-03-31 Thread Heinrich Apfelmus
Dear haskell-cafe,

I've been thinking about space leaks lately. In particular, I've been
studying the tricky example with pairs

break [] = ([],[])
break (x:xs) = if x == '\n' then ([],xs) else (x:ys,zs)
where (ys,zs) = break xs

which was discussed in the papers

Jan Sparud. Fixing some space leaks without a garbage collector.
http://bit.ly/cOxcVJ

Philip Wadler. Fixing some space leaks with a garbage collector.
http://homepages.inf.ed.ac.uk/wadler/topics/garbage-collection.html

As I understand it, GHC implements the technique from Sparud's paper, so
this is a solved problem. (It will only kick in when compiled with
optimization, though, so -O0 will make the above leak in GHC 6.10.4 if I
checked that correctly.)


Now, I'm wondering about alternative solutions. Wadler mentions some
sort of parallel combinators

break xs = (PAR before '\n' ys, PAR after '\n' zs)
where (ys,zs) = SYNCLIST xs

which were introduced by John Hughes in his Phd thesis from 1983. They
are intriguing! Unfortunately, I haven't been able to procure a copy of
Hughes' thesis, either electronic or in paper. :( Can anyone help? Are
there any other resources about this parallel approach?



Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe