hbcmake PEIf you are elsewhere, you will need to download and compile the sources (30K). The binding-time checker (BT.hs) is quite a large module, and you will need to give

The partial evaluator is best invoked by a command of the form

PE M <termA Haskell module is read from

`-btcheck`invokes a binding-time checker before specialisation. This is highly recommended!`-unfoldlets`invokes a post-processor that unfolds trivial`let`s, that is, those that bind a variable to another variable. However, the `right' way to unfold`let`s, if that's what you want to do, is to annotate the source program that they are unfolded during partial evaluation. If you rely on the post-processor instead, then as soon as a non-trivial let appears in a residual program, it will not be unfolded.

PE - -btcheck M <term

The Haskell subset includes:

- Integer, boolean, and string constants.
- Pairs.
- Lists (but not list comprehensions or arithmetic sequences; strings are not lists).
- Primitive operations: || && == /= < <= >= > : ++ + = * div .
(++ is restricted to
`String`only; you will need to define`append`yourself to concatenate lists). - Conditional expressions.
- Lambda expressions and applications.
- Datatype definitions, constructors and case expressions. The patterns in
a case must be simple, that is a constructor applied to
variables. Pattern matching may
*only*be used in a case expression. Pattern matching on lists and pairs is supported. - Do notation.
- Definition by a single equation.
- Imports.

`$2`,`$True`,`$"x"`are a static integer, boolean and string.`lift x`converts a static integer or string`x`into a dynamic one.`x$+y`and`x$==$0`are static primitive operations.`(x$,y)`is a static pair.`$[x,y,z]`and`x$:xs`are static lists.`\$x $y -> x+y`is a static lambda expression;`f$@x`is a static application.`$f`is a static reference to a global name`f`(that will be unfolded by the specializer).`f $x $y z = e`defines a function whose first two arguments are bound by static lambdas. Such a function*must*be unfolded at all call sites; a call might appear as`$f $@x $@y z`.`$C x y z`is a static constructor application, and`$case e of C x y z->e'`is a corresponding static case expression. Here`e`must be static, so that the`case`can be simplified, but the branches of the case need not be.`$if x then y else z`is a static conditional, which will be simplifed to one of the branches by the specialiser. Once again, the branches need not be static.`$import M`is a static import declaration, which instructs the specialiser to read module`M.hs`and add the definitions it finds there to the code to be specialised.

If you just want to try the partial evaluator out, you can run it on our web server.

Last modified: Mon Sep 29 14:32:41 MET DST 1997