Personal tools

Super combinator

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Lambda lifting example)
(Using supercombinators for compilation)

Latest revision as of 06:11, 20 July 2010

A supercombinator is either a constant, or a combinator which contains only supercombinators as subexpressions.



  • every lambda abstraction in E is a supercombinator.

So these are supercombinators:

  • 0
  • \x y -> x + y


  • \x -> y
  • \x -> y + x



Any lambda calculus expression (or, indeed, Haskell program) with no free variables can be converted into supercombinators using lambda lifting. For example, the last example can be expressed as:

  • \f g -> f ((\h x -> h x 2) g)

Because supercombinators have no free variables, they can always be given their own names and let floated to the top level. The last example, for example, can be rewritten as:

  • let { scF h x = h x 2; scE f g = f (scF g) } in scE

Some older compilers for Haskell-like languages, such as Gofer, used this as part of the compilation process. Converting a whole program into supercombinators leaves no internal lambda abstractions left, and each supercombinator can then be compiled more or less directly into a lower-level language, such as the G machine.

A supercombinator which is not a lambda abstraction (i.e. for which n=0) is called a constant applicative form.