Strict Haskell debate

Andy Gill andy at galois.com
Fri Feb 17 18:37:09 EST 2006


On Feb 17, 2006, at 3:30 PM, Ashley Yakeley wrote:

> Andy Gill wrote:
>> I'd like to see a way of enforcing return strictness, that is  
>> where you
>> have confidence that what a function is returning is fully evaluated.
>> Imagine a function hstrict;
>>      hstrict :: a -> a
>
> Is this like deepseq, that strictly evaluates internal structure  
> using seq?

yes. it is.

>
>> With hstrict you can write functions in the style.
>> fun f a b c = hstrict $ ....
>>   where
>>     ...
>>     ...
>
> But surely fun can return the unevaluated thunk (hstrict x)? Since  
> hstrict has not yet been called, it can't do its strictifying  
> magic, whatever that is.
>

No. hstrict will always be called before returning. Evaluation does
not return thunks, they get created by lets/where (at the core level),
not by function application/evaluation.

Andy Gill



More information about the Haskell-prime mailing list