|
|
|
|
|
Proposal: make all pattern bindings completely monomorphic (regardless of type signatures)
|
|
|
|
|
|
|
|
|
At the moment you can say
|
|
|
|
|
|
```wiki
|
|
|
let (f,g) = e in ...
|
|
|
```
|
|
|
|
|
|
|
|
|
and get \*polymorphic\* values f,g. This causes a good deal of trouble in the implementation (think of what the System F translation looks like), and it's an odd thing to do. Why odd? Well here it's fine:
|
|
|
|
|
|
```wiki
|
|
|
data T = C (forall a. a->a)
|
|
|
h x = let C f = e in ...
|
|
|
```
|
|
|
|
|
|
|
|
|
Constructor C has a polymorphic argument, so we can match e against (C f) and get a polymorphic function. But in the first example, (,) only takes monomorphic arguments, so we have to generalise after selection. To put it another way, even if the "…" is definitely strict in f, we cannot transform to
|
|
|
|
|
|
```wiki
|
|
|
case e of (f,g) -> ...
|
|
|
```
|
|
|
|
|
|
|
|
|
I've been meaning to give GHC a flag to give it this behaviour, so that I can see if any Haskell programs break. My bet is that this is a feature that is tricky to implement, but which is virtually never used. Removing it would simplify the language. |