Prevent optimization from tempering with unsafePerformIO

Stefan O'Rear stefanor at cox.net
Tue Oct 16 16:32:31 EDT 2007


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 does. I could explain what all the parts mean and why they
> are defined this way, if it is important. On first glance it looks
> as if we were doing unsafe things in the very worst way. But the
> invariants within the generated code clean up things again. E.g., the
> result of main does not at all depend on whether or not the program is
> evaluated eagerly or lazily.
> 
> I hope it is okay that I did not add any no-inline pragmata or something
> like that. Unfortunately, I forgot all the things we have tried more
> than a year ago to make optimization work.

Might I suggest, that the problem is your use of unsafePerformIO?  If
you use unsafePerformIO in accordance with the rules listed in the
specification (which happens to be the FFI addendum), -O options will
have no effect.  (Not that what you are trying to do is achievable with
correct use of unsafePerformIO; why do you want to do this unsafely,
instead of just using 'length'?  unsafePerformIO is a very slow
function, remember)

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20071016/10062c72/attachment.bin


More information about the Glasgow-haskell-users mailing list