1. 13 Dec, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Improve free-variable handling for rnPat and friends (fixes Trac #1972) · 7f2909e0
      simonpj@microsoft.com authored
      As well as fixing the immediate problem (Trac #1972) this patch does
      a signficant simplification and refactoring of pattern renaming.
      Fewer functions, fewer parameters passed....it's all good.  But it
      took much longer than I expected to figure out.
      The most significant change is that the NameMaker type does *binding*
      as well as *making* and, in the matchNameMaker case, checks for unused
      bindings as well.  This is much tider.
      (No need to merge to the 6.8 branch, but no harm either.)
  2. 01 Nov, 2007 1 commit
  3. 27 Oct, 2007 1 commit
    • simonpj@microsoft.com's avatar
      In a pattern binding, a type sig in the pattern cannot bind a type variable · 2f647ec6
      simonpj@microsoft.com authored
      In a pattern binding with a pattern type signature, such as
      	(Just (x::a)) = e
      the pattern type signature cannot bind type variables.  Hence
      'a' must be in scope already for the above example to be legal.
      This has been the situation for some time, but Dan changed it when
      adding view patterns.  This one-line change restores the old behaviour.
  4. 10 Oct, 2007 1 commit
    • Dan Licata's avatar
      View patterns, record wildcards, and record puns · 6a05ec5e
      Dan Licata authored
      This patch implements three new features:
      * view patterns (syntax: expression -> pat in a pattern)
      * working versions of record wildcards and record puns
      See the manual for detailed descriptions.
      Other minor observable changes:
      * There is a check prohibiting local fixity declarations
        when the variable being fixed is not defined in the same let
      * The warn-unused-binds option now reports warnings for do and mdo stmts
      Implementation notes: 
      * The pattern renamer is now in its own module, RnPat, and the
      implementation is now in a CPS style so that the correct context is
      delivered to pattern expressions.
      * These features required a fairly major upheaval to the renamer.
      Whereas the old version used to collect up all the bindings from a let
      (or top-level, or recursive do statement, ...) and put them into scope
      before renaming anything, the new version does the collection as it
      renames.  This allows us to do the right thing with record wildcard
      patterns (which need to be expanded to see what names should be
      collected), and it allows us to implement the desired semantics for view
      patterns in lets.  This change had a bunch of domino effects brought on
      by fiddling with the top-level renaming.
      * Prior to this patch, there was a tricky bug in mkRecordSelId in HEAD,
      which did not maintain the invariant necessary for loadDecl.  See note
      [Tricky iface loop] for details.