[Haskell-cafe] Re: what is inverse of mzero and return?
daniel.is.fischer at web.de
Mon Jan 24 18:29:53 EST 2005
Am Dienstag, 25. Januar 2005 00:29 schrieb Jorge Adriano Aires:
>> x = getLine >>= putStrLn
>This isn't obvious to me. So x is an action, and it does not always produces
>the same side effects when executed. But why should that make x/=x? It is the
>same action, it gets one line from the input, and then prints it...
OK, but then the different side-effects could not be used to distinguish
putStrLn "hello" >> mzero
and mzero. So I still believe, if you say these two are different, because
they produce different output, you cannot easily insist on x === x.
>A constant c :: a is just morphism(function) c : 0 -> a, where 0 is the
>initial object (empty set).
The empty set being an initial object means, for every a there is exactly one
morphism from 0 to a. A constant is a function from a one-element-set to a.
> This I don't agree with, I think you are using the word actions for two
> different things, the elements of type IO a, and their execution. What you
You're right, but one of my problems is to identify elements of type IO a.
If the returned value isn't the thing, the execution must matter, but which
parts of the execution are to be taken into account?
> just showed is that those IO () elements (actions) when executed, always
> created different side effects in the real world. Not that the actions
> themselves are different.
But that is the problem, what does it mean for two actions to be the same?
After all, writing "hello" to stdout is just a side-effect, like putting 4 on
the stack and immediately ignoring it.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe