[Haskell-cafe] Optimizing unamb by determining the "state" of a thunk?

Thomas Davie tom.davie at gmail.com
Mon Apr 20 05:19:14 EDT 2009


On 20 Apr 2009, at 10:57, Peter Verswyvelen wrote:

> On Mon, Apr 20, 2009 at 10:23 AM, Thomas Davie <tom.davie at gmail.com>  
> wrote:
> Really?  Is it any less referentially transparent than unamb already  
> is - i.e. it's referentially transparent, as long as the two values  
> really are equal.
>
> I think it is. Suppose we call the function hnf :: a -> Bool. hnf  
> might return a different result for the same argument, since the  
> evaluation of the argument might be happening on a different thread,  
> so the result of hnf depends on the time when it is evaluated.  Or  
> am I missing something here?

Sure, so hnf would give us a non-determined result, but I don't think  
that makes unamb any less referentially transparent – the same value  
is always returned, and always reduced at least to hnf.

Bob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090420/bc032b89/attachment.htm


More information about the Haskell-Cafe mailing list