Re: Prevent optimization from tempering with unsafePerformIO

2007-10-17 Thread Josef Svenningsson
Hi again, On 10/17/07, Bernd Brassel <[EMAIL PROTECTED]> wrote: > > May I suggest a third route that has the advantages of both your > > approaches. The backside is of course that it takes a bit of work. My > > suggestion is to do an effect analysis of your curry programs to > > identify the purel

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-17 Thread Isaac Dupree
Bernd Brassel wrote: * I'm not sure if you care whether they are performed once or many times. E.g. f = \x. x + unsafePerformIO (h z) If the (h z) doesn't mention 'x', GHC will transform this to v = unsafePerformIO (h z) f = \x. x+v So now the effe

RE: Prevent optimization from tempering with unsafePerformIO

2007-10-17 Thread Simon Peyton-Jones
I think you'll find it useful to be explicit about what you are relying on. For example I think that if your program contains two calls unsafePerformIO e1 unsafePerformIO e2 then * You don't care about the *order* in which these are performed * You do care that they are both p

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-17 Thread David Sabel
Hi Bernd, Bernd Brassel wrote: Hi David, thank you! This is really useful information! I think it's the let floating (out) together with common subexpression elimination: > ghc --make -O2 -no-recomp -fno-cse -o curry-no-cse curry.hs [1 of 1] Compiling Main ( curry.hs, curr

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-17 Thread Josef Svenningsson
On 10/17/07, Bernd Brassel <[EMAIL PROTECTED]> wrote: > > why do you want to do this unsafely, > > instead of just using 'length'? unsafePerformIO is a very slow > > function, remember) > > The big picture is that we generate programs like this example in order > to compile the functional logic la

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-17 Thread Bernd Brassel
Hi Stefan! Thanks for your answer. Stefan O'Rear wrote: > Might I suggest, that the problem is your use of unsafePerformIO? Yes you might. And you are surely right. But not using it in this way is not an alternative. > why do you want to do this unsafely, > instead of just using 'length'? un

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-16 Thread Stefan O'Rear
On Tue, Oct 16, 2007 at 04:06:26PM +0200, Bernd Brassel wrote: > Hi Neil, hi Don! > > Nice meeting you at ICFP by the way. > > > Can you give a specific example of what you have tried to do, and how it > > failed? > > I have attached a short synopsis of what our Curry to Haskell > conceptually d

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-16 Thread David Sabel
Hi, I think it's the let floating (out) together with common subexpression elimination: > ghc --make -O2 -no-recomp -fno-cse -o curry-no-cse curry.hs [1 of 1] Compiling Main ( curry.hs, curry.o ) Linking curry-no-cse ... > ghc --make -O2 -no-recomp -fno-full-laziness -o curry-no

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-16 Thread Bernd Brassel
Neil Mitchell schrieb: > It varies by each piece of code, can you post a code fragment that > gets optimised in the wrong way? Sorry for posting this twice! I have added the code to the other thread. Thanks! Bernd ___ Glasgow-haskell-users mailing lis

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-16 Thread Bernd Brassel
Hi Neil, hi Don! Nice meeting you at ICFP by the way. > Can you give a specific example of what you have tried to do, and how it > failed? I have attached a short synopsis of what our Curry to Haskell conceptually does. I could explain what all the parts mean and why they are defined this way, i

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-15 Thread Don Stewart
bbr: > Hello, > > I am writing a compiler from the functional logic language Curry to > Haskell. As the result is a real extension of Haskell, there has to be > SOME side effect involved. Unfortunately, this seems to prevent me from > using any of ghc's optimizations on the resulting code. I have

Re: Prevent optimization from tempering with unsafePerformIO

2007-10-15 Thread Neil Mitchell
Hi Bernd, > I am writing a compiler from the functional logic language Curry to > Haskell. As the result is a real extension of Haskell, there has to be > SOME side effect involved. Unfortunately, this seems to prevent me from > using any of ghc's optimizations on the resulting code. I have tried