A definition is lifted from a where
or
let
into the surrounding binding group. Such
lifting widens the scope of the definition.
showAll :: Show a => [a] -> String
showAll = table . map show
where
format [] = []
format [x] = [x]
format (x:xs) = (x ++ "\n") : format xs
table = concat . format
|
showAll :: Show a => [a] -> String
showAll = table format . map show
where
format :: [String] -> [String]
format [] = ...
table :: ([String] -> [String]) -> [String] -> String
table format = concat . format
|
General comment:
Left to right comment:
This composite refactoring is more general than Promotion as it
will compensate for any free variables unbound at
the outer scope by making them parameters
of the lifted definition. This is the process of
λ-lifting (lambda-lifting), and
is accomplished by Generalisation.
| Right to left comment:
This is a composite refactoring that can be realised by
applying Promotion right
to left, and then removing the parameters: a
specialisation, in other words. |
Left to right conditions:
| Right to left conditions:
|
Static scope analysis; call graph; type checking; module analysis.