Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Jake McArthur
Ah! It seems that my wording was ambiguous. All I was trying to say is that there is nothing you can do with an IO action which will cause an otherwise pure expression to exhibit side effects during evaluation, *not* that an IO action is observable in pure code or that they are arbitrarily manipula

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Fri, Aug 09, 2013 at 12:38:45AM +0700, Kim-Ee Yeoh wrote: > On Thu, Aug 8, 2013 at 11:05 PM, Tom Ellis > wrote: > > On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: > > > >One could simply implement IO as a free monad > > > Interesting. I wonder how. > > > > See [1] for an e

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Kim-Ee Yeoh
On Thu, Aug 8, 2013 at 11:05 PM, Tom Ellis < tom-lists-haskell-cafe-2...@jaguarpaw.co.uk> wrote: > On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: > > >One could simply implement IO as a free monad > > Interesting. I wonder how. > > See [1] for an explanation of free monads in

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 05:44:11PM +0100, Tom Ellis wrote: > On Thu, Aug 08, 2013 at 06:25:12PM +0200, Daniel Trstenjak wrote: > > > See [1] for an explanation of free monads in general. For IO in > > > particular, > > > define a functor > > > > > > data IOF a = GetChar (Char -> a) | PutChar

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 06:25:12PM +0200, Daniel Trstenjak wrote: > > See [1] for an explanation of free monads in general. For IO in particular, > > define a functor > > > > data IOF a = GetChar (Char -> a) | PutChar Char a | ... > > > > with constructors for all elementary IO operations. >

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 05:23:50PM +0100, Oliver Charles wrote: > On 08/08/2013 05:05 PM, Tom Ellis wrote: > > On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: > >>> One could simply implement IO as a free monad > >> Interesting. I wonder how. > > > > See [1] for an explanation

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Daniel Trstenjak
Hi Tom, > See [1] for an explanation of free monads in general. For IO in particular, > define a functor > > data IOF a = GetChar (Char -> a) | PutChar Char a | ... > > with constructors for all elementary IO operations. But how should this work if the user adds an IO operation, e.g by wr

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Oliver Charles
On 08/08/2013 05:05 PM, Tom Ellis wrote: > On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: >>> One could simply implement IO as a free monad >> Interesting. I wonder how. > > See [1] for an explanation of free monads in general You're lacking a matching definition of [1] :)

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: > >One could simply implement IO as a free monad > Interesting. I wonder how. See [1] for an explanation of free monads in general. For IO in particular, define a functor data IOF a = GetChar (Char -> a) | PutChar Char a | .

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Jerzy Karczmarczuk
I am sorry for having mixed-up arguments (but who throws the first stone?...) Jerzy seemed to suggest that the "impurity" of IO was somehow related to it not supporting very many operations. No, not really. I added First, it is not true that you can do with, say, (printStr "Ho!" ) whatever

Re: [Haskell-cafe] Identity of indiscernibles (Was: Alternative name for return)

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 08:41:25AM -0400, Jake McArthur wrote: > I don't know what the denotation for this would be, but I can't think of > any reasonable ones for which I can write (==) to respect the denotation. > For example, is "set A, then set B" equal to "set B, then set A"? [...] I'm a bit

Re: [Haskell-cafe] Identity of indiscernibles (Was: Alternative name for return)

2013-08-08 Thread Jake McArthur
I don't know what the denotation for this would be, but I can't think of any reasonable ones for which I can write (==) to respect the denotation. For example, is "set A, then set B" equal to "set B, then set A"? Maybe you could argue that they aren't operationally equivalent, but can you guarantee

Re: [Haskell-cafe] Identity of indiscernibles (Was: Alternative name for return)

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 11:38:08AM +0200, Jerzy Karczmarczuk wrote: > Tom Ellis: > >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