argument naming rule in haskell

Viewed 396

For what reason is it not allowed for an argument with the same name to appear more than once in the same equation? Examples:

f a a = show a

d && d = d
_ && _ = False

Technically speaking, formal parameters (The Report calls these variables.) are also patterns---it's just that they never fail to match a value. As a "side effect" of the successful match, the formal parameter is bound to the value it is being matched against. For this reason patterns in any one equation are not allowed to have more than one occurrence of the same formal parameter (a property called linearity §3.17, §3.3, §4.4.3).

2 Answers
Related