| 5 | I propose that we '''make all pattern bindings completely monomorphic (regardless of type signatures)'''. As a result, the expression |

| 6 | {{{ |

| 7 | let (p,q) = (\x -> x, True) in (p True, p 'c') |

| 8 | }}} |

| 9 | would fail to typecheck, because it requires p to be polymorphic. The program would be rejected even if p had a type signature: |

| 10 | {{{ |

| 11 | let { p :: a -> a |

| 12 | ; (p,q) = (\x -> x, True) |

| 13 | } in (p True, p 'c') |

| 14 | }}} |

| 15 | We need to be precise about what a "pattern binding" is. Definition: '''a pattern binding has the form ''pat''=''rhs'', where ''pat'' is not simply a variable. Examples: |

| 16 | {{{ |

| 17 | (x,y) = e -- Pattern binding |

| 18 | [x] = e -- Pattern binding |

| 19 | (x) = e -- Pattern binding |

| 20 | x@y = e -- Pattern binding |

| 21 | ~x = e -- Pattern binding |

| 22 | |

| 23 | x = e -- NOT a pattern binding |

| 24 | }}} |

| 25 | This rule is simple and easy to remember. |

| 26 | |

| 27 | Notice that enclosing the variable in parens, thus (x)=e, makes it a pattern binding, and therfore forces it to be monomorphic. So this is a way to get the monomorphic form of binding that John Hughes has, at times, argued for. |

| 28 | |

| 29 | Another way to say it is this: only function bindings are generalised, where a function binding has the form |

| 30 | f p1 ... pn = e |

| 31 | |

| 32 | where n>=0. The n=0 case is a bare variable. |

| 33 | |

| 34 | === Discussion === |