It would be nice if future Haskell implementations were able to display
function values in some standard form. In particular, closures might
be represented as local definitions binding free variables in a
final function value representation.

There are two arguments against this. The first is philosophical and runs
roughly:

   Functions are Platonic objects hovering in the timeless void. After a
   computation there may be a final value but it has no unique representation.
   Hence, attempts to display a specific representation are misleading.

However, we're plainly happy with inputing initial representations of
functions so why not output representations as well?

The second objection is pragmatic, along the lines of:

   There are lots of different ways of implementing languages. There
   are no standard internal representations for functions. In a given
   implementation it may be hard to reverse engineer internal
   representations to external representations.

Indeed, producing external from internal representations may be hard. In
particular, trying to display closures to minimise repetitive printing of
shared free variable bindings in nested "updated" functions is non-trivial.

However, there are big benefits in easing debugging by allowing tracing of
function applications, especially "partial application" of higher order
functions. Function representations coupled with regular types would also
enable Haskell to be used in teaching pure lambda calculus.

Greg Michaelson

Reply via email to