• 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.
DynFlags.hs 60.9 KB