Re: [Haskell-cafe] is value evaluated?

2009-05-09 Thread Lennart Augustsson
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 d...@galois.com wrote: Andy Gill has been advocating programmatic access to the 'is evaluated' status bit for years now. 'seq' becomes

Re: [Haskell-cafe] is value evaluated?

2009-05-09 Thread Brandon S. Allbery KF8NH
On May 8, 2009, at 16:31 , Sittampalam, Ganesh wrote: Brandon S. Allbery KF8NH wrote: Unless it catches exceptions itself (which strikes me as a bad idea; it becomes a trivial way to ignore exceptions, leading to bad programming practices) either they're handled inside the _|_ (in which case it

RE: [Haskell-cafe] is value evaluated?

2009-05-09 Thread Sittampalam, Ganesh
Brandon S. Allbery KF8NH wrote: On May 8, 2009, at 16:31 , Sittampalam, Ganesh wrote: Brandon S. Allbery KF8NH wrote: Unless it catches exceptions itself (which strikes me as a bad idea; it becomes a trivial way to ignore exceptions, leading to bad programming practices) either they're

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Jochem Berndsen
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

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Ketil Malde
Nikhil Patil patil.nik...@gmail.com writes: 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 Well, obviously you can't do this, it would violate referential transparency.

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Brandon S. Allbery KF8NH
On May 8, 2009, at 01:33 , Joe Fredette wrote: That strikes me as being bad in a I'm violating the Halting Problem sort of way- but I'm not sure how. Is there some contradictory construction that could be built from such a function? I don't think it is; surely the Haskell runtime knows

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Joe Fredette
That must have been the vibe I was getting. My haskell-spider senses were tingling, I just overshot RT and went for the Halting Problem. /Joe Brandon S. Allbery KF8NH wrote: On May 8, 2009, at 01:33 , Joe Fredette wrote: That strikes me as being bad in a I'm violating the Halting Problem

RE: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Sittampalam, Ganesh
Brandon S. Allbery KF8NH wrote: On May 8, 2009, at 01:33 , Joe Fredette wrote: That strikes me as being bad in a I'm violating the Halting Problem sort of way- but I'm not sure how. Is there some contradictory construction that could be built from such a function? I don't think it is;

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Brandon S. Allbery KF8NH
On May 8, 2009, at 13:08 , Sittampalam, Ganesh wrote: Brandon S. Allbery KF8NH wrote: and therefore must be in IO. You may be thinking that it would return a result for _|_, but as described if you fed it _|_ it could only produce False (if the _|_ has been evaluated you would not be able to

RE: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Sittampalam, Ganesh
Brandon S. Allbery KF8NH wrote: On May 8, 2009, at 13:08 , Sittampalam, Ganesh wrote: Brandon S. Allbery KF8NH wrote: and therefore must be in IO. You may be thinking that it would return a result for _|_, but as described if you fed it _|_ it could only produce False (if the _|_ has been

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Don Stewart
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

[Haskell-cafe] is value evaluated?

2009-05-07 Thread Nikhil Patil
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 And I expect it to be such that the following terminates after printing the first 101 fibonacci numbers. fibs = 0 : 1 :

Re: [Haskell-cafe] is value evaluated?

2009-05-07 Thread Joe Fredette
That strikes me as being bad in a I'm violating the Halting Problem sort of way- but I'm not sure how. Is there some contradictory construction that could be built from such a function? Nikhil Patil wrote: Hi, I am curious to know if there is a function in Haskell to find if a certain value