f 1 y = 1
f x y = x + 1
|
f 1 x = (1, x)
f x y = (x + 1, y)
{- f1 :: Num t1 => ( t1 -> t ) -> t1 -}
f1 1 x = 1
f1 x y = x + 1
{- f2 :: Num t => ( t -> t1 ) -> t1 -}
f2 1 x = x
f2 x y = y
|
General comment:
New type signatures are also generated for the new definitions. The new types are the most general inferred type.
Left to right comment:
Tuple elements are extracted into unique definitions. Each new definition contains the extracted computation required for a particular element of the tuple; the computation is extracted from the original definition in question. For example, f1
contains the computation (extracted from f
) required to compute the first element of the return tuple of f
.
Right to left comment:
This is defined in merging. Merging multiple definitions together to form a new function returning a tuple.
Left to right conditions:
The selected definition must return a tuple or a single value (as opposed to, say, a list).
At least two definitions must be selected to perform the merge.
Right to left conditions: