
On Thu, Aug 08, 2013 at 01:19:27AM +0200, Jerzy Karczmarczuk wrote:
Bardur Arantsson comments the comment of Joe Quinn:
On 8/7/2013 11:00 AM, David Thomas wrote:
twice :: IO () -> IO () twice x = x >> x
I would call that evaluating x twice (incidentally creating two separate evaluations of one pure action description), but I'd like to better see your perspective here.
x is only evaluated once, but/executed/ twice. For IO, that means magic. For other types, it means different things. For Identity, twice = id!
Your point being? x is the same thing regardless of how many times you run it.
What do you mean by "the same thing"? You cannot compare 'them' in any reasonable sense.
This, the impossibility to check putStr "c" == putStr "c", is btw, a refutation of the claim by Tom Ellis that you can do even less with (). The void object is an instance of the Eq and Ord classes. And of Show as well.
If I were writing a Haskell compiler I could certainly define 'IO' to be a datatype that would allow me to compare 'putStr "c"' to itself. The comparison could not be of operational equivalence, but it would still be possible to compare values in IO in a reasonable sense. Tom