Changes between Version 4 and Version 5 of MonomorphicPatternBindings


Ignore:
Timestamp:
Sep 1, 2006 4:48:48 PM (8 years ago)
Author:
simonpj@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MonomorphicPatternBindings

    v4 v5  
    4949== Experiment == 
    5050 
    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. 
     51In 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. 
    5252 
    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.  
     53The 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{{{ 
     55import Control.Monad.ST 
    5456 
    55 My conclusion: polymorphic pattern bindings is a feature that is virtually never used.  We should nuke them. 
     57newtype ListMap m a b = ListMap ([a] -> m [b]) 
    5658 
     59runMap :: (forall s. ListMap (ST s) a b) -> [a] -> [b] 
     60runMap lf as = runST (f as) 
     61          where ListMap f = lf 
     62}}} 
     63This no longer works because {{{f}}} isn't polymorphic, and {{{runST}}} needs it to be.  It's easily fixed: 
     64{{{ 
     65runMap lf as = runST (f as) 
     66          where f = case lf of { ListMap f -> f } 
     67}}} 
     68My conclusion: polymorphic pattern bindings is a feature that is virtually never used, and not even necessary then.  We should nuke them. 
     69