Skip to content
  • Simon Peyton Jones's avatar
    Fix and refactor strict pattern bindings · e3f341f3
    Simon Peyton Jones authored
    This patch was triggered by Trac #11601, where I discovered that
    -XStrict was really not doing the right thing. In particular,
    
      f y = let !(Just x) = blah[y] in body[y,x]
    
    This was evaluating 'blah' but not pattern matching it
    against Just until x was demanded.  This is wrong.
    
    The patch implements a new semantics which ensures that strict
    patterns (i.e. ones with an explicit bang, or with -XStrict)
    are evaluated fully when bound.
    
    * There are extensive notes in DsUtils:
      Note [mkSelectorBinds]
    
    * To do this I found I need one-tuples;
      see Note [One-tuples] in TysWiredIn
    
    I updated the user manual to give the new semantics
    e3f341f3