Changes between Version 4 and Version 5 of MonomorphicPatternBindings
- Timestamp:
- 09/01/06 09:48:48 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MonomorphicPatternBindings
v4 v5 49 49 == Experiment == 50 50 51 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. 51 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. 52 52 53 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. 53 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 54 {{{ 55 import Control.Monad.ST 54 56 55 My conclusion: polymorphic pattern bindings is a feature that is virtually never used. We should nuke them. 57 newtype ListMap m a b = ListMap ([a] -> m [b]) 56 58 59 runMap :: (forall s. ListMap (ST s) a b) -> [a] -> [b] 60 runMap lf as = runST (f as) 61 where ListMap f = lf 62 }}} 63 This no longer works because {{{f}}} isn't polymorphic, and {{{runST}}} needs it to be. It's easily fixed: 64 {{{ 65 runMap lf as = runST (f as) 66 where f = case lf of { ListMap f -> f } 67 }}} 68 My conclusion: polymorphic pattern bindings is a feature that is virtually never used, and not even necessary then. We should nuke them. 69
