On Thu, Aug 8, 2013 at 7:40 AM, Timon Gehr <timon.gehr@gmx.ch> wrote:
You make the distinction between "evaluate",

Which essentially means applying reduction rules to an expression until the result is a value.

and  "execute" or "run", etc. This is not functional.

How would you know?

I think Jerzy is alluding to the fact that we don't have a denotational semantics for IO. So I'm not sure I understand your response. Are you pointing out that some subspace of IO programs admit such a semantics via an easy inspection?

'putStr "c"' is a pure value. 

This is the crux of the matter: "pure value" means different things to different people.

Some employ it to mean an effectful monadic expression to distinguish between getLine and (return "Hello"), both of type IO String.

Others use it to distinguish between an ordinary Haskell expression and, say, C.

So when you write:

> 'unsafePerformIO (putStr "c")' is not a pure value.

I infer you're in the latter camp.

Would you then speak of 'effectful' values vs 'null-effectful' ones? What oral syntax would you actually use?

-- Kim-Ee


On Thu, Aug 8, 2013 at 7:40 AM, Timon Gehr <timon.gehr@gmx.ch> wrote:
On 08/08/2013 01:19 AM, 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.
...

http://en.wikipedia.org/wiki/Identity_of_indiscernibles

(He is reasoning _about_ the language and not _within_ the language because Haskell does not support very powerful reasoning internally.)

...

You make the distinction between "evaluate",

Which essentially means applying reduction rules to an expression until the result is a value.


and  "execute" or "run", etc. This is not functional.

How would you know?

Your program doesn't "run" anything, it
applies (>>=) (or equivalent) to an IO (...) object. This is the only
"practical evaluation" of it, otherwise it can  be passed (or duplicated
as above). But you cannot apply "bind" twice to the same instance of it
(in fact, as I said above, "the same instance"  is a bit suspicious
concept...).
...

Indeed, but you didn't say that above.


The "running" or "execution" takes place outside of your program. In
such a way Richard O'Keefe and I converge... That's why I say that the
concept of purity is meaningless in the discussed context.

Not meaningless, but redundant. The point of having a purely functional programming language is to have reasoning based on purity be universally applicable.

It is a kind of counterfeit notion, inherited from "pure functions" to something
which belongs to two different worlds.
...

'putStr "c"' is a pure value.

On the other hand:

'unsafePerformIO (putStr "c")' is not a pure value.

(But this expression does not exist in standard Haskell. unsafePerformIO "unquotes" the action. You may be confusing the "quoted" and "unquoted" versions.)



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe