Introduce A New Definition


Identity: NewDefinition
Category: Naming
Classifiers: expression definition
Internal cross references:
External cross references:
Language: Haskell

Description:

A definition can be introduced to denote an identified sub-expression, and the sub-expression will be replaced by a call to the new definition.



addThree = \ a b c -> a + b + c
    

addThree = \ a b c -> f a b c
    where
    f a b c = a + b + c

General comment:

Left to right comment:

The definition is introduced as a local definition, and it can be lifted afterwards. Formal parameters will be added to the new definition iff the free variables in the identified sub-expression won't be accessable by to new definition.

Right to left comment:

Left to right conditions:

The name for the new definition should not cause name capture/clash.

Right to left conditions:

Analysis required: Static analysis of bindings; call graph;