1. 24 Jul, 2010 1 commit
  2. 06 May, 2010 1 commit
  3. 20 Aug, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Improvements to record puns, wildcards · d64022dc
      simonpj@microsoft.com authored
      * Make C { A.a } work with punning, expanding to C { A.a = a }
      
      * Make it so that, with -fwarn-unused-matches, 
              f (C {..}) = x
        does not complain about the bindings introduced by the "..".
      
      * Make -XRecordWildCards implies -XDisambiguateRecordFields.
      
      * Overall refactoring of RnPat, which had become very crufty. 
        In particular, there is now a monad, CpsRn, private to RnPat,
        which deals with the cps-style plumbing.  This is why so many
        lines of RnPat have changed.
      
      * Refactor the treatment of renaming of record fields into two passes
      	- rnHsRecFields1, used both for patterns and expressions,
      	     which expands puns, wild-cards
        	- a local renamer in RnPat for fields in patterns
      	- a local renamer in RnExpr for fields in construction and update
        This make it all MUCH easier to understand
       
      * Improve documentation of record puns, wildcards, and disambiguation
      d64022dc
  4. 24 Jul, 2009 1 commit
  5. 07 Jul, 2009 1 commit
  6. 01 Jul, 2009 1 commit
  7. 24 Apr, 2009 2 commits
  8. 04 Feb, 2009 1 commit
  9. 13 Jan, 2009 2 commits
  10. 30 Oct, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Improve error reporting for non-rigid GADT matches · 259d5ea8
      simonpj@microsoft.com authored
      Following suggestions from users, this patch improves the error message
      when a GADT match needs a rigid type:
      
       tcfail172.hs:19:10:
           GADT pattern match in non-rigid context for `Nil'
      -      Solution: add a type signature
      +      Probable solution: add a type signature for `is_normal'
           In the pattern: Nil
           In the definition of `is_normal': is_normal Nil = True
      
      Now GHC tries to tell you what to give a type signature *for*.
      Thanks to Daniel Gorin and others for the suggestions.
      259d5ea8
  11. 20 Sep, 2008 1 commit
  12. 09 Oct, 2008 1 commit
  13. 01 Oct, 2008 2 commits
  14. 01 Aug, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #2478 · 6344b150
      simonpj@microsoft.com authored
      A minor glitch that shows up only when a data constructor has *both* a
      "stupid theta" in the data type decl, *and* an existential type variable.
      6344b150
  15. 10 Jun, 2008 1 commit
  16. 06 May, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #2246; overhaul handling of overloaded literals · ecdaf6bc
      simonpj@microsoft.com authored
      The real work of fixing Trac #2246 is to use shortCutLit in
      MatchLit.dsOverLit, so that type information discovered late in the
      day by the type checker can still be exploited during desugaring.
      
      However, as usual I found myself doing some refactoring along the
      way, to tidy up the handling of overloaded literals.   The main
      change is to split HsOverLit into a record, which in turn uses
      a sum type for the three variants.  This makes the code significantly
      more modular.
      
      data HsOverLit id
        = OverLit {
      	ol_val :: OverLitVal, 
      	ol_rebindable :: Bool,		-- True <=> rebindable syntax
      					-- False <=> standard syntax
      	ol_witness :: SyntaxExpr id,	-- Note [Overloaded literal witnesses]
      	ol_type :: PostTcType }
      
      data OverLitVal
        = HsIntegral   !Integer   	-- Integer-looking literals;
        | HsFractional !Rational   	-- Frac-looking literals
        | HsIsString   !FastString 	-- String-looking literals
      ecdaf6bc
  17. 22 Apr, 2008 2 commits
  18. 10 Apr, 2008 1 commit
  19. 29 Feb, 2008 1 commit
  20. 28 Feb, 2008 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Remove GADT refinements, part 1 · 4226903d
      chak@cse.unsw.edu.au. authored
      - A while ago, I changed the type checker to use equality constraints together
        with implication constraints to track local type refinement due to GADT
        pattern matching.  This patch is the first of a number of surgical strikes
        to remove the resulting dead code of the previous GADT refinement machinery.
      
        Hurray to code simplification!
      4226903d
  21. 17 Jan, 2008 1 commit
  22. 18 Jan, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Add quasi-quotation, courtesy of Geoffrey Mainland · f3399c44
      simonpj@microsoft.com authored
      This patch adds quasi-quotation, as described in
        "Nice to be Quoted: Quasiquoting for Haskell"
      	(Geoffrey Mainland, Haskell Workshop 2007)
      Implemented by Geoffrey and polished by Simon.
      
      Overview
      ~~~~~~~~
      The syntax for quasiquotation is very similar to the existing
      Template haskell syntax:
      	[$q| stuff |]
      where 'q' is the "quoter".  This syntax differs from the paper, by using
      a '$' rather than ':', to avoid clashing with parallel array comprehensions.
       
      The "quoter" is a value of type Language.Haskell.TH.Quote.QuasiQuoter, which
      contains two functions for quoting expressions and patterns, respectively.
       
           quote = Language.Haskell.TH.Quote.QuasiQuoter quoteExp quotePat
       
           quoteExp :: String -> Language.Haskell.TH.ExpQ
           quotePat :: String -> Language.Haskell.TH.PatQ
      
      TEXT is passed unmodified to the quoter. The context of the
      quasiquotation statement determines which of the two quoters is
      called: if the quasiquotation occurs in an expression context,
      quoteExp is called, and if it occurs in a pattern context, quotePat
      is called.
      
      The result of running the quoter on its arguments is spliced into
      the program using Template Haskell's existing mechanisms for
      splicing in code. Note that although Template Haskell does not
      support pattern brackets, with this patch binding occurrences of
      variables in patterns are supported. Quoters must also obey the same
      stage restrictions as Template Haskell; in particular, in this
      example quote may not be defined in the module where it is used as a
      quasiquoter, but must be imported from another module.
      
      Points to notice
      ~~~~~~~~~~~~~~~~
      * The whole thing is enabled with the flag -XQuasiQuotes
      
      * There is an accompanying patch to the template-haskell library. This
        involves one interface change:
      	currentModule :: Q String
        is replaced by
      	location :: Q Loc
        where Loc is a data type defined in TH.Syntax thus:
            data Loc
              = Loc { loc_filename :: String
      	      , loc_package  :: String
      	      , loc_module   :: String
      	      , loc_start    :: CharPos
      	      , loc_end      :: CharPos }
      
            type CharPos = (Int, Int)	-- Line and character position
       
        So you get a lot more info from 'location' than from 'currentModule'.
        The location you get is the location of the splice.
        
        This works in Template Haskell too of course, and lets a TH program
        generate much better error messages.
      
      * There's also a new module in the template-haskell package called 
        Language.Haskell.TH.Quote, which contains support code for the
        quasi-quoting feature.
      
      * Quasi-quote splices are run *in the renamer* because they can build 
        *patterns* and hence the renamer needs to see the output of running the
        splice.  This involved a bit of rejigging in the renamer, especially
        concerning the reporting of duplicate or shadowed names.
      
        (In fact I found and removed a few calls to checkDupNames in RnSource 
        that are redundant, becuase top-level duplicate decls are handled in
        RnNames.)
      
      
      f3399c44
  23. 04 Jan, 2008 1 commit
  24. 24 Dec, 2007 1 commit
  25. 08 Dec, 2007 1 commit
  26. 07 Dec, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Properly keep track of whether normalising given or wanted dicts · b6d08641
      chak@cse.unsw.edu.au. authored
      - The information of whether given or wanted class dictionaries where
        normalised by rewriting wasn't always correctly propagated in TcTyFuns,
        which lead to malformed dictionary bindings.
      - Also fixes a bug in TcPat.tcConPat where GADT equalities where emitted in
        the wrong position in case bindings (which led to CoreLint failures).
      b6d08641
  27. 20 Nov, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      TcPat.tcConPat uses equalities instead of GADT refinement · a003ad80
      chak@cse.unsw.edu.au. authored
      * This patch implements the use of equality constraints instead of GADT
        refinements that we have been discussing for a while.
      * It just changes TcPat.tcConPat.  It doesn't have any of the simplification
        and dead code removal that is possible due to this change.
      * At the moment, this patch breaks a fair number of GADT regression tests.
      a003ad80
  28. 21 Nov, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Make rebindable do-notation behave as advertised · 1d1c3c72
      simonpj@microsoft.com authored
      Adopt Trac #1537.  The patch ended up a bit bigger than I expected,
      so I suggest we do not merge this into the 6.8 branch.  But there
      is no funadamental reason why not.
      
      With this patch, rebindable do-notation really does type as if you
      had written the original (>>) and (>>=) operations in desguared form.
      
      I ended up refactoring some of the (rather complicated) error-context
      stuff in TcUnify, by pushing an InstOrigin into tcSubExp and its
      various calls. That means we could get rid of tcFunResTy, and the
      SubCtxt type.  This should improve error messages slightly
      in complicated situations, because we have an Origin to hand
      to instCall (in the (isSigmaTy actual_ty) case of tc_sub1).
      
      Thanks to Pepe for the first draft of the patch.
      1d1c3c72
  29. 19 Nov, 2007 1 commit
  30. 14 Nov, 2007 1 commit
  31. 16 Oct, 2007 1 commit
  32. 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.
      6a05ec5e
  33. 29 Sep, 2007 1 commit
  34. 28 Sep, 2007 1 commit
  35. 06 Sep, 2007 1 commit
  36. 04 Sep, 2007 1 commit