effective partial evaluator yet?

Duncan Coutts duncan.coutts at worcester.oxford.ac.uk
Thu Jul 15 09:35:45 EDT 2004

On Thu, 2004-07-15 at 08:57, Simon Peyton-Jones wrote:
> | My current prototype uses GHC and Template Haskell. It can only
> | specialise functions that manipulate first order values. It does work
> | for a number of simple examples eg Ackerman function (specialised on
> | first argument), matrix multiplication (specialising on fixed size
> | matrices), a simple language interpreter (specialised to a fixed input
> | program).
> You're doing PE of full Haskell, right?  Another possibility would be to
> do PE of Core.  It's a much, much, much, much smaller language.   Why
> would you want to do it at the Haskell source level?

Being able to see the resulting code is helpful both to me and would
also be useful to users. Haskell coders know Haskell, but rather fewer
know ghc core. It's very useful for users to get feedback on how much
specialisation they've got vs what they expected. This would be rather
harder if they have to compare source code in two languages.

> (Apart from the fact that's what TH directly supports?)  

Having all the infrastructure does help a great deal. The part of my
basic PE that does any useful work (as opposed to just walking over
syntax trees - I should be using generics) is only about 100 lines. It's
not as hard as you'd think, I don't need a self interpreter (which would
be a big task).

> Admittedly, if you want annotations, then getting them through to Core
> un-harmed would require a little work.

At the moment the annotations are identity function applications, that
we pick up on as we traverse over the syntax tree.


More information about the Glasgow-haskell-users mailing list