[Haskell-cafe] is value evaluated?

Lennart Augustsson lennart at augustsson.net
Sat May 9 01:52:57 EDT 2009


But testing for something being evaluated has to be in the IO monad,
or else you're going to break the semantics.

On Fri, May 8, 2009 at 4:14 PM, Don Stewart <dons at galois.com> wrote:
> Andy Gill has been advocating programmatic access to the 'is evaluated'
> status bit for years now. 'seq' becomes cheaper, and we can write
> operational properties/assertions about strictness.
>
> -- Don
>
>
> jochem:
>> Nikhil Patil wrote:
>> > Hi,
>> >
>> > I am curious to know if there is a function in Haskell to find if a
>> certain
>> > value has already been evaluated. The function I need would have the type:
>> >
>> >> (?!) :: a -> Bool
>>
>> I will call this function `evaluated', since it is not a binary operator.
>>
>> The existence of such a function would violate referential transparency.
>>
>> What would the value of
>> ( evaluated (fibs !! 100), evaluated (fibs !! 100) )
>> be ? Suppose that I first print the `fst' of this tuple, then print the
>> 101st Fibonacci nummber, and then print the `snd' of this tuple. By lazy
>> evaluation, one would expect that this yields
>>
>> False
>> <the 101st Fibonacci number>
>> True
>>
>> but this violates referential transparency.
>>
>> Cheers,
>> --
>> Jochem Berndsen | jochem at functor.nl
>> GPG: 0xE6FABFAB
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list