... | ... | @@ -77,10 +77,28 @@ So this proposal makes the bang-pattern proposal easier to describe [ http://hac |
|
|
## 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.
|
|
|
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. I deliberately made the new behaviour the default so that I'd hear of any breakage.
|
|
|
|
|
|
|
|
|
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.
|
|
|
The interesting observation is this: all of the libraries compile without a tremor, and I have received only one message remarking on the new behaviour. Ross Paterson sent me this code
|
|
|
|
|
|
```wiki
|
|
|
import Control.Monad.ST
|
|
|
|
|
|
newtype ListMap m a b = ListMap ([a] -> m [b])
|
|
|
|
|
|
runMap :: (forall s. ListMap (ST s) a b) -> [a] -> [b]
|
|
|
runMap lf as = runST (f as)
|
|
|
where ListMap f = lf
|
|
|
```
|
|
|
|
|
|
|
|
|
This no longer works because `f` isn't polymorphic, and `runST` needs it to be. It's easily fixed:
|
|
|
|
|
|
```wiki
|
|
|
runMap lf as = runST (f as)
|
|
|
where f = case lf of { ListMap f -> f }
|
|
|
```
|
|
|
|
|
|
|
|
|
My conclusion: polymorphic pattern bindings is a feature that is virtually never used. We should nuke them. |
|
|
My conclusion: polymorphic pattern bindings is a feature that is virtually never used, and not even necessary then. We should nuke them. |