[Haskell-cafe] Small optimisation question
andrewcoppin at btinternet.com
Sat Nov 17 11:31:33 EST 2007
Stefan O'Rear wrote:
> On Sat, Nov 17, 2007 at 04:10:58PM +0000, Andrew Coppin wrote:
>> OK. I presume this is due to the fact that the result of executing an
>> expression at compile-time could be arbitrarily large?
> Yes, and it's not even guaranteed to terminate.
That would be "arbitrarily large", yes. ;-)
>> Are there any buttons that can be twiddled to control this behaviour?
> Not that I'm aware of, though you can hack something with RULEs
I was just wondering whether there was some way to say "please unravel
this expression until the result is X units big" or something. Oh well.
(I'm sure Template Haskell could do it if you wanted it that badly... or
just write a small Haskell program that writes a Haskell program. Eeps!)
>> For that matter, when I say "[4,7,2,9]", what does that compile into? Some
>> data structures in memory? Or code to actually build said structures?
> Both. A curious feature of the STG machine is that constructor thunks
> and evaluated data are represented identically in memory.
Ooo... As per the Lambdacats "Boxed cat has a uniform representation"?
Well, presumably the guys who designed STG did it this way for a really
good reason, and they know far more than me, so... ;-)
More information about the Haskell-Cafe