|
|
## Make pattern bindings monomorphic
|
|
|
|
|
|
|
|
|
|
|
|
Proposal: make all pattern bindings completely monomorphic (regardless of type signatures)
|
|
|
|
... | ... | @@ -27,7 +30,18 @@ Constructor C has a polymorphic argument, so we can match e against (C f) and ge |
|
|
case e of (f,g) -> ...
|
|
|
```
|
|
|
|
|
|
## Experiment
|
|
|
|
|
|
|
|
|
|
|
|
In July I changed GHC (the HEAD) to make pattern bindings monomorphic by default. (A binding of a simple variable is not considered to be a pattern binding.) The flag `-fno-mono-pat-binds` restores the standard behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
The interesting observation is this: all of the libraries compile without a tremor, and I have received no mail whatsoever complaining about the new behaviuor. I deliberated made the new behaviour the default so that I'd hear of any breakaga.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
My conclusion: polymorphic pattern bindings is a feature that is virtually never used. We should nuke them.
|
|
|
|
|
|
|