RE: GHC rewrite rules pragma

2008-05-30 Thread Simon Peyton-Jones
| This is the main wibble people forget when writing rules -- inlining. | In your example, 'gen' is so cheap, it is immediately | inlined, so it won't be available to match on in your rule. I'll add a note in the user manual about this. In general, GHC tries RULES before inlining. In this parti

Re: GHC rewrite rules pragma

2008-05-27 Thread Jan Jakubuv
thanks, it works fine now. 2008/5/27 Don Stewart <[EMAIL PROTECTED]>: > jakubuv: >> Thanks lot, it works now. Now, I have just a simple question: >> >> Is there any chance to make rewriting working in ghci ? > > I think you can actually enable them by putting: > > {-# OPTIONS -frewrite-rules #-}

Re: GHC rewrite rules pragma

2008-05-27 Thread Don Stewart
jakubuv: > Thanks lot, it works now. Now, I have just a simple question: > > Is there any chance to make rewriting working in ghci ? I think you can actually enable them by putting: {-# OPTIONS -frewrite-rules #-} at the top of the file to be interpreted. Works for me, anyway. -- Don _

Re: GHC rewrite rules pragma

2008-05-27 Thread Jan Jakubuv
Thanks lot, it works now. Now, I have just a simple question: Is there any chance to make rewriting working in ghci ? jan. 2008/5/27 Don Stewart <[EMAIL PROTECTED]>: > jakubuv: >> Hi, >> >> I'm trying to find out how the GHC rewrite rules pragma work, but I'm >> not able to make it working. I ha

Re: GHC rewrite rules pragma

2008-05-27 Thread Don Stewart
jakubuv: > Hi, > > I'm trying to find out how the GHC rewrite rules pragma work, but I'm > not able to make it working. I have this simple example, where I would > like to specialize the function gen to spec on strings: > > {-# OPTIONS -O2 -fglasgow-exts #-} > > gen :: [a] -> a > gen = head > >