Remove dead code

Identity: Redundant
Category: Structural MultiModule
Classifiers: Redundant definition
Internal cross references:
External cross references:
Language: Haskell

f x y =  z + y
             z = x + 42 + l
             l = fac 5 * 2
             r = 2 * fac 4

f x y =  z + y
             z = x + 42 + l
             l = fac 5 * 2

General comment:

Dead code is eliminated from a definition paramaterised over a selected subterm or the right hand side of the definition in question.

Left to right comment:

Parts of a function that are not required to evaluate the right hand side are removed. This applies directly to declarations defined in where clauses, let expressions are lambda terms. The refactoring also goes one step further in that the user can highlight a particular sub term, invoking the refactorer to remove parts of the definition that are not required to evaluate the highlighted subterm. This technique is a style of backwards, static program slicing.

Right to left comment:

No comment.

Left to right conditions:


Right to left conditions:


Analysis required: Call Graph, dependancy analysis, program slice.