Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Heinrich Apfelmus
Steve Horne wrote: Heinrich Apfelmus wrote: Maybe it helps to try to find an example of a function f :: A - B for some cleverly chosen types A,B that is not pure, i.e. does not return the same values for equal arguments. [..] For your specific challenge, place that as a left-hand

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Heinrich Apfelmus
Conal Elliott wrote: I wrote that post to point out the fuzziness that fuels many discussion threads like this one. See also http://conal.net/blog/posts/notions-of-purity-in-haskell/ and the comments. I almost never find value in discussion about whether language X is functional, pure, or

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Bardur Arantsson
On 12/29/2011 07:07 PM, Steve Horne wrote: On 29/12/2011 10:05, Jerzy Karczmarczuk wrote: Sorry, a long and pseudo-philosophical treatise. Trash it before reading. Heinrich Apfelmus: You could say that side effects have been moved from functions to some other type (namely IO) in Haskell. I

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Bardur Arantsson
On 12/29/2011 11:06 PM, Steve Horne wrote: On 29/12/2011 21:01, Chris Smith wrote: On Thu, 2011-12-29 at 18:07 +, Steve Horne wrote: By definition, an intentional effect is a side-effect. To me, it's by deceptive redefinition - and a lot of arguments rely on mixing definitions - but

Re: [Haskell-cafe] On the purity of Haskell /Random generators

2011-12-30 Thread Bardur Arantsson
On 12/29/2011 09:39 PM, Jerzy Karczmarczuk wrote: Truly random numbers are very rarely used, forget about them. Well, obviously, but why should we forget about them? The usual approach(*) is to gather entropy from a truly(**) random source and use that to seed (and perhaps periodically

Re: [Haskell-cafe] Overloaded Quotes for Template Haskell

2011-12-30 Thread James Cook
One possible option would be to make a library that has all the combinators lifted to your more general type and use lift or runQ or something similar for any quotes that need lifting, along with operations from monad-control or monad-peel to lift quotes that also need access to the StateT

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 29, 2011, at 2:16 PM, Steve Horne wrote: Of course you can extract values out of IO actions to work with them - the bind operator does this for you nicely, providing the value as an argument to the function you pass to the right-hand argument of the bind. But that function returns

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Artyom Kazak
Gregg Reynolds d...@mobileink.com писал(а) в своём письме Fri, 30 Dec 2011 17:23:20 +0200: Regarding side-effects, they can be (informally) defined pretty simply: any non-computational effect caused by a computation is a side-effect. I wonder: can writing to memory be called a

Re: [Haskell-cafe] (...) Random generators

2011-12-30 Thread Jerzy Karczmarczuk
Bardur Arantsson: Random streams are not referentially transparent, though, AFAICT...? Either way this thread has gone on long enough, let's not prolong it needlessly with this side discussion. Sure. But the discussion on randomness is /per se/ interesting, especially in a functional

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 10:34 AM, Artyom Kazak wrote: Gregg Reynolds d...@mobileink.com писал(а) в своём письме Fri, 30 Dec 2011 17:23:20 +0200: Regarding side-effects, they can be (informally) defined pretty simply: any non-computational effect caused by a computation is a side-effect.

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Chris Smith
On Fri, 2011-12-30 at 18:34 +0200, Artyom Kazak wrote: I wonder: can writing to memory be called a “computational effect”? If yes, then every computation is impure. If no, then what’s the difference between memory and hard drive? The difference is that our operating systems draw an

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 12:52 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Conal Elliott wrote: I wrote that post to point out the fuzziness that fuels many discussion threads like this one. See also http://conal.net/blog/posts/**

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 8:12 AM, Conal Elliott co...@conal.net wrote: On Fri, Dec 30, 2011 at 12:52 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Conal Elliott wrote: I wrote that post to point out the fuzziness that fuels many discussion threads like this one. See also

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 10:19 AM, Conal Elliott wrote: On Fri, Dec 30, 2011 at 12:49 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The function f :: Int - IO Int f x = getAnIntFromTheUser = \i - return (i+x) is pure according to the common definition of pure in the

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Colin Adams
On 30 December 2011 16:59, Gregg Reynolds d...@mobileink.com wrote: On Fri, Dec 30, 2011 at 12:49 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The function f :: Int - IO Int f x = getAnIntFromTheUser = \i - return (i+x) is pure according to the common definition of pure in

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Chris Smith
time t: f 42 (computational process implementing func application begins…) t+1: keystroke = 1 t+2: 43 (… and ends) time t+3: f 42 t+4: keystroke = 2 t+5: 44 Conclusion: f 42 != f 42 That conclusion would only follow if the same IO action always produced the same

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 11:04 AM, Colin Adams wrote: On 30 December 2011 16:59, Gregg Reynolds d...@mobileink.com wrote: On Fri, Dec 30, 2011 at 12:49 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The function f :: Int - IO Int f x = getAnIntFromTheUser = \i - return

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Heinrich Apfelmus
Conal Elliott wrote: Heinrich Apfelmus wrote: The function f :: Int - IO Int f x = getAnIntFromTheUser = \i - return (i+x) is pure according to the common definition of pure in the context of purely functional programming. That's because f 42 = f (43-1) = etc. Put differently, the

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Colin Adams
On 30 December 2011 17:17, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:04 AM, Colin Adams wrote: On 30 December 2011 16:59, Gregg Reynolds d...@mobileink.com wrote: On Fri, Dec 30, 2011 at 12:49 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The function

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 9:11 AM, Chris Smith cdsm...@gmail.com wrote: time t: f 42 (computational process implementing func application begins…) t+1: keystroke = 1 t+2: 43 (… and ends) time t+3: f 42 t+4: keystroke = 2 t+5: 44 Conclusion: f 42 != f 42 That

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 9:20 AM, Colin Adams colinpaulad...@gmail.comwrote: On 30 December 2011 17:17, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:04 AM, Colin Adams wrote: On 30 December 2011 16:59, Gregg Reynolds d...@mobileink.com wrote: On Fri, Dec 30, 2011 at

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Colin Adams
On 30 December 2011 17:27, Conal Elliott co...@conal.net wrote: On Fri, Dec 30, 2011 at 9:20 AM, Colin Adams colinpaulad...@gmail.comwrote: proof: f is a function, and it is taking the same argument each time. Therefore the result is the same each time. Careful of circular reasoning here.

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 9:19 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Conal Elliott wrote: Heinrich Apfelmus wrote: The function f :: Int - IO Int f x = getAnIntFromTheUser = \i - return (i+x) is pure according to the common definition of pure in the context of

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 9:30 AM, Colin Adams colinpaulad...@gmail.comwrote: On 30 December 2011 17:27, Conal Elliott co...@conal.net wrote: On Fri, Dec 30, 2011 at 9:20 AM, Colin Adams colinpaulad...@gmail.comwrote: proof: f is a function, and it is taking the same argument each time.

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 11:20 AM, Colin Adams wrote: On 30 December 2011 17:17, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:04 AM, Colin Adams wrote: On 30 December 2011 16:59, Gregg Reynolds d...@mobileink.com wrote: On Fri, Dec 30, 2011 at 12:49 AM, Heinrich

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 11:11 AM, Chris Smith wrote: time t: f 42 (computational process implementing func application begins…) t+1: keystroke = 1 t+2: 43 (… and ends) time t+3: f 42 t+4: keystroke = 2 t+5: 44 Conclusion: f 42 != f 42 That conclusion would only

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 9:43 AM, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:20 AM, Colin Adams wrote: On 30 December 2011 17:17, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:04 AM, Colin Adams wrote: On 30 December 2011 16:59, Gregg Reynolds

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 9:43 AM, Conal Elliott co...@conal.net wrote: On Fri, Dec 30, 2011 at 9:43 AM, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:20 AM, Colin Adams wrote: On 30 December 2011 17:17, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:04 AM,

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 11:19 AM, Heinrich Apfelmus wrote: Conal Elliott wrote: Heinrich Apfelmus wrote: The function f :: Int - IO Int f x = getAnIntFromTheUser = \i - return (i+x) is pure according to the common definition of pure in the context of purely functional programming. That's

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Steve Horne
On 30/12/2011 10:41, Bardur Arantsson wrote: This doesn't sound right to me. To me, a side effect is something which happens as a (intended or unintended) consequence of something else. An effect which you want to happen (e.g. by calling a procedure, or letting the GHC runtime interpreting

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 11:43 AM, Conal Elliott wrote: roof: f is a function, and it is taking the same argument each time. Therefore the result is the same each time. That's called begging the question. f is not a function, so I guess your proof is flawed. It seems pretty clear that

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Donn Cave
Quoth Steve Horne sh006d3...@blueyonder.co.uk, On 30/12/2011 10:41, Bardur Arantsson wrote: This doesn't sound right to me. To me, a side effect is something which happens as a (intended or unintended) consequence of something else. An effect which you want to happen (e.g. by calling a

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Gregg Reynolds
On Dec 30, 2011, at 11:21 AM, Conal Elliott wrote: And I also raised a more fundamental question than whether this claim of sameness is true, namely what is equality on IO? Without a precise consistent definition of equality, the claims like f 42 == f (43 - 1) are even defined, let

Re: [Haskell-cafe] (...) Random generators

2011-12-30 Thread Bardur Arantsson
On 12/30/2011 04:38 PM, Jerzy Karczmarczuk wrote: Bardur Arantsson: Random streams are not referentially transparent, though, AFAICT...? Either way this thread has gone on long enough, let's not prolong it needlessly with this side discussion. Sure. But the discussion on randomness is

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 10:24 AM, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:43 AM, Conal Elliott wrote: roof: f is a function, and it is taking the same argument each time. Therefore the result is the same each time. That's called begging the question. f is not a

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Steve Horne
On 30/12/2011 15:23, Gregg Reynolds wrote: Now one way of understanding all this is to say that it implicates the static/dynamic (compile-time/run-time) distinction: you don't know what e.g. IO values are until runtime, so this distinction is critical to distinguishing between pure and

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Conal Elliott
On Fri, Dec 30, 2011 at 10:45 AM, Gregg Reynolds d...@mobileink.com wrote: On Dec 30, 2011, at 11:21 AM, Conal Elliott wrote: And I also raised a more fundamental question than whether this claim of sameness is true, namely what is equality on IO? Without a precise consistent definition

Re: [Haskell-cafe] Overloaded Quotes for Template Haskell

2011-12-30 Thread Michael D. Adams
I'm not very familiar with monad-control, but it looks like the equivalent of liftWith from monad-control would be a function that has type StateT S Q a - Q (S - (a, S)). IIUC, you are suggesting that the code would look something like restoreT [| ... $( liftWith ( ... ) ) ... |]. Unfortunately,

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Steve Horne
On 30/12/2011 15:50, Gregg Reynolds wrote: On Dec 30, 2011, at 10:34 AM, Artyom Kazak wrote: Gregg Reynoldsd...@mobileink.com писал(а) в своём письме Fri, 30 Dec 2011 17:23:20 +0200: Regarding side-effects, they can be (informally) defined pretty simply: any non-computational effect

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Chris Smith
On Fri, 2011-12-30 at 12:45 -0600, Gregg Reynolds wrote: I spent some time sketching out ideas for using random variables to provide definitions (or at least notation) for stuff like IO. I'm not sure I could even find the notes now, but my recollection is that it seemed like a promising

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Artyom Kazak
Donn Cave d...@avvanta.com писал(а) в своём письме Fri, 30 Dec 2011 20:36:46 +0200: That's why we use terms in a sense that apply meaningfully to computer programming languages in general and Haskell in particular. To do otherwise - for example to insist on a definition of pure that could

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Chris Smith
On Fri, 2011-12-30 at 12:24 -0600, Gregg Reynolds wrote: No redefinition involved, just a narrowing of scope. I assume that, since we are talking about computation, it is reasonable to limit the discussion to the class of computable functions - which, by the way, are about as deeply embedded

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Artyom Kazak
Chris Smith cdsm...@gmail.com писал(а) в своём письме Fri, 30 Dec 2011 22:04:21 +0200: Computability is just a distraction here. The problem isn't whether getAnIntFromUser is computable... it is whether it's a function at all! Even uncomputable functions are first and foremost functions,

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Chris Smith
On Fri, 2011-12-30 at 23:16 +0200, Artyom Kazak wrote: Thus, your function “f” is a function indeed, which generates a list of instructions to kernel, according to given number. Not my function, but yes, f certainly appears to be a function. Conal's concern is that if there is no possible

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Scott Turner
On 2011-12-30 14:32, Steve Horne wrote: A possible way to implement a Haskell program would be... 1. Apply rewrite rules to evaluate everything possible without executing primitive IO actions. 2. Wait until you need to run the program. 3. Continue applying rewrite rules to evaluate

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Artyom Kazak
Chris Smith cdsm...@gmail.com писал(а) в своём письме Fri, 30 Dec 2011 22:28:36 +0200: I really think that the notion of “purity” appeared to convince C programmers. It would be silly to try to explain that “Int - IO Int” isn't really a function from Int to Int, monads, blah blah blah. So,

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Steve Horne
On 30/12/2011 10:47, Bardur Arantsson wrote: On 12/29/2011 11:06 PM, Steve Horne wrote: Using similar mixed definitions to conclude that every C program is full of bugs (basically equating intentional effects with side-effects, then equating side-effects with unintentional bugs) is a fairly

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Steve Horne
On 30/12/2011 20:38, Scott Turner wrote: On 2011-12-30 14:32, Steve Horne wrote: A possible way to implement a Haskell program would be... 1. Apply rewrite rules to evaluate everything possible without executing primitive IO actions. 2. Wait until you need to run the program. 3.

[Haskell-cafe] purity and the season of good will

2011-12-30 Thread Chris Dornan
(Whether readers would consider the post [or indeed this post] an act of trollery was mooted and mentioned several times in the original post - my thoughts at the end. I am writing this because I would have expected somebody to have said this by now. If it has been said then my sincere apologies.

[Haskell-cafe] Plugins on ghc 7.2: GHC does not export defaultCallbacks

2011-12-30 Thread Brian Victor
Hi all, As a getting-my-feet-wet project I was starting to look into using plugins-auto with the yesod devel server, but I was quickly stymied because the plugins package isn't building on GHC 7.2. The error I get locally is the same as the one reported by hackage[1]. In short,

Re: [Haskell-cafe] Level of Win32 GUI support in the Haskell platform

2011-12-30 Thread Ivan Perez
I'm using Gtk2hs in windows (and linux) with no big problems. Cairo also works. Glade does not allow me to use accents in the user interfaces on windows, but otherwise works ok. I haven't tried wx on windows. It works on linux and it provides a more natural interface (gtk will look like gtk also

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Bardur Arantsson
On 12/30/2011 10:10 PM, Steve Horne wrote: On 30/12/2011 10:47, Bardur Arantsson wrote: On 12/29/2011 11:06 PM, Steve Horne wrote: Calling it a straw man won't convince anyone who has the scars from being attacked by those straw men. I've been in those arguments, being told that C has

[Haskell-cafe] Copy .cabal folder to diff machine/user

2011-12-30 Thread Vagif Verdi
Is it possible to copy .cabal and .ghc folders to different machine/ user and develop same project over there ? Or is the only way to allow a team of developers to work on the same project is to force each one of them to install all necessary packages on their machines.

Re: [Haskell-cafe] Copy .cabal folder to diff machine/user

2011-12-30 Thread Ivan Lazar Miljenovic
On 31 December 2011 10:49, Vagif Verdi vagif.ve...@gmail.com wrote: Is it possible to copy .cabal and .ghc folders to different machine/ user and develop same project over there ? If you have the same version of GHC and necessary C libraries on all machines, and they're all using the same

Re: [Haskell-cafe] Copy .cabal folder to diff machine/user

2011-12-30 Thread Vagif Verdi
The problem is, i tried and it does not work. Cabal has absolute paths hardcoded in many places. So just copying folders does not work unless you copy it under the same home folder. On Dec 30, 4:16 pm, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 31 December 2011 10:49, Vagif Verdi

Re: [Haskell-cafe] Plugins on ghc 7.2: GHC does not export defaultCallbacks

2011-12-30 Thread Brian Victor
For anyone interested, here's a patch I came up with that seems to fix the build failure. I'm trying now to reach the relevant parties to get this included in the package. diff -rN -u old-hs-plugins/src/System/Plugins/Load.hs new-hs-plugins/src/System/Plugins/Load.hs ---

Re: [Haskell-cafe] Copy .cabal folder to diff machine/user

2011-12-30 Thread Ivan Lazar Miljenovic
On 31 December 2011 11:27, Vagif Verdi vagif.ve...@gmail.com wrote: The problem is, i tried and it does not work. Cabal has absolute paths hardcoded in many places. So just copying folders does not work unless you copy it under the same home folder. sed the ~/.ghc/*/package.conf.d/* files,

[Haskell-cafe] Twidge using hashtags

2011-12-30 Thread Martin de Bruin
Hello! fairly new to twidge. Got it installed and have it setting status etc etc . I'm maintaing a local website supporting the eating of a seasonal pastry in a highly competitve fashion. A race of sorts. The contestant eating the most from january first to good friday wins. To keep the eating as