
If you say {-# INLINE f #-} on a fn defn for f, it'll get inlined at all its call sites, which is sort of what you want. Just saying 'evaluate this CAF to WHNF' might only inline the outer combinator. Generally, some precise way of controlling what gets evaluated at compile time, a bit less heavyweight than MetaML, would be a fine thing. After all that's what C++ templates are. But the details of a workable design aren't clear to me. Ideas? Simon | -----Original Message----- | From: David Feuer [mailto:David_Feuer@brown.edu] | Sent: 01 February 2002 07:41 | To: glasgow-haskell-users@haskell.org | Subject: partial evaluation | Sensitivity: Confidential | | | It seems to me that it might be useful (and probably | fairly easy) to add to GHC a limited sort of partial | evaluation: programmer-designated top-level CAFs could be | evaluated to WHNF during compilation. Termination of that | compiler phase would obviously not be guaranteed, but if | this were possible, I am guessing it would be very useful | for some applications, such as combinator-based parsers. | The parsers would then be generated at compiler time | rather than re-generated every time the parser is | executed. If GHC in fact supports something of this | nature, I would love to hear about it. If it does not, I | would guess it would probably be fairly easy to add to the | end of the code generation phase. | | David Feuer | | This message has been brought to you by the letter alpha and | the number pi. | | | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-| haskell-users |