1. 23 Jul, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Add tuple sections as a new feature · 58521c72
      simonpj@microsoft.com authored
      This patch adds tuple sections, so that
      
      	(x,,z)  means   \y -> (x,y,z)
      
      Thanks for Max Bolinbroke for doing the hard work.
      
      In the end, instead of using two constructors in HsSyn, I used
      just one (still called ExplicitTuple) whose arguments can be
      	Present (LHsExpr id)
      or	Missing PostTcType
      
      While I was at it, I did a bit of refactoring too.
      58521c72
  2. 07 Jul, 2009 1 commit
  3. 02 Jul, 2009 1 commit
  4. 01 Jul, 2009 1 commit
  5. 03 Jun, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Allow RULES for seq, and exploit them · 90ce88a0
      simonpj@microsoft.com authored
      Roman found situations where he had
            case (f n) of _ -> e
      where he knew that f (which was strict in n) would terminate if n did.
      Notice that the result of (f n) is discarded. So it makes sense to
      transform to
            case n of _ -> e
      
      Rather than attempt some general analysis to support this, I've added
      enough support that you can do this using a rewrite rule:
      
        RULE "f/seq" forall n.  seq (f n) e = seq n e
      
      You write that rule.  When GHC sees a case expression that discards
      its result, it mentally transforms it to a call to 'seq' and looks for
      a RULE.  (This is done in Simplify.rebuildCase.)  As usual, the
      correctness of the rule is up to you.
      
      This patch implements the extra stuff.  I have not documented it explicitly
      in the user manual yet... let's see how useful it is first.
      
      The patch looks bigger than it is, because
        a) Comments; see esp MkId Note [seqId magic]
      
        b) Some refactoring.  Notably, I moved the special desugaring for
           seq from MkCore back into DsUtils where it properly belongs.
           (It's really a desugaring thing, not a CoreSyn invariant.)
      
        c) Annoyingly, in a RULE left-hand side we need to be careful that
           the magical desugaring done in MkId Note [seqId magic] item (c) 
           is *not* done on the LHS of a rule. Or rather, we arrange to 
           un-do it, in DsBinds.decomposeRuleLhs.
      
      90ce88a0
  6. 31 Mar, 2009 1 commit
  7. 05 Dec, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Add static flag -fsimple-list-literals · 6f547477
      simonpj@microsoft.com authored
      The new static flag -fsimple-list-literals makes ExplicitList literals
      be desugared in the straightforward way, rather than using 'build' as
      now.  See SLPJ comments with Note [Desugaring explicit lists].
      
      I don't expect this flag to be used by users (hence no docs). It's just
      there to let me try the performance effects of switching on and off.
      6f547477
  8. 03 Nov, 2008 1 commit
  9. 28 Oct, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Mostly-fix Trac #2595: updates for existentials · 0db3e625
      simonpj@microsoft.com authored
      Ganesh wanted to update records that involve existentials.  That 
      seems reasonable to me, and this patch covers existentials, GADTs,
      and data type families.
      
      The restriction is that 
        The types of the updated fields may mention only the
        universally-quantified type variables of the data constructor
      
      This doesn't allow everything in #2595 (it allows 'g' but not 'f' in
      the ticket), but it gets a lot closer.
      
      Lots of the new lines are comments!
      0db3e625
  10. 12 Sep, 2008 1 commit
  11. 26 Aug, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Fix flaggery for RULES (cf Trac #2497) · 24b1e136
      simonpj@microsoft.com authored
      This patch executes the plan described in the discussion in Trac #2497.
      Specficially:
      
          * Inside a RULE, switch on the forall-as-keyword in the lexer,
            unconditionally. (Actually this is done by an earlier patch.)
      
          * Merge the -XScopedTypeVariables and -XPatternSignatures flags,
            and deprecate the latter. Distinguishing them isn't senseless,
            but it's jolly confusing.
      
          * Inside a RULE, switch on -XScopedTypeVariables unconditionally. 
      
          * Change -frewrite-rules to -fenable-rewrite-rules; deprecate the former. 
            Internally the DynFlag is now Opt_EnableRewriteRules.
      
      There's a test in typecheck/should_compile/T2497.hs
      24b1e136
  12. 11 Aug, 2008 1 commit
  13. 31 Jul, 2008 1 commit
  14. 29 Mar, 2008 1 commit
  15. 28 Feb, 2008 2 commits
  16. 11 Feb, 2008 1 commit
  17. 03 Feb, 2008 1 commit
  18. 05 Feb, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Make do-notation a bit more flexible (Trac #1537) · bddd4b23
      simonpj@microsoft.com authored
      This is a second attempt to fix #1537: to make the static typechecking
      of do-notation behave just like the desugared version of the same thing.
      This should allow parameterised monads to work properly (see Oleg's comment
      in the above ticket).
      
      We can probably merge to 6.8.3 if it goes smoothly.
      
      Incidentally, the resulting setup suffers from greater type ambiguity
      if (>>=) has a very general type.  So test rebindable6 no longer works
      (at least not without more type signatures), and rebindable5 requires
      extra functional dependencies.  But they are weird tests.
      bddd4b23
  19. 17 Jan, 2008 1 commit
  20. 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
  21. 04 Sep, 2007 1 commit
  22. 03 Sep, 2007 1 commit
  23. 01 Sep, 2007 1 commit
  24. 22 Aug, 2007 1 commit
  25. 21 Jun, 2007 1 commit
    • David Himmelstrup's avatar
      Add several new record features · 2eb04ca0
      David Himmelstrup authored
      1. Record disambiguation (-fdisambiguate-record-fields)
      
      In record construction and pattern matching (although not
      in record updates) it is clear which field name is intended
      even if there are several in scope.  This extension uses
      the constructor to disambiguate.  Thus
      	C { x=3 }
      uses the 'x' field from constructor C (assuming there is one)
      even if there are many x's in scope.
      
      
      2. Record punning (-frecord-puns)
      
      In a record construction or pattern match or update you can 
      omit the "=" part, thus
      	C { x, y }
      This is just syntactic sugar for
      	C { x=x, y=y }
      
      
      3.  Dot-dot notation for records (-frecord-dot-dot)
      
      In record construction or pattern match (but not update) 
      you can use ".." to mean "all the remaining fields".  So
      
      	C { x=v, .. }
      
      means to fill in the remaining fields to give
      
      	C { x=v, y=y }
      
      (assuming C has fields x and y).  This might reasonably
      considered very dodgy stuff.  For pattern-matching it brings
      into scope a bunch of things that are not explictly mentioned;
      and in record construction it just picks whatver 'y' is in
      scope for the 'y' field.   Still, Lennart Augustsson really
      wants it, and it's a feature that is extremely easy to explain.
      
      
      Implementation
      ~~~~~~~~~~~~~~
      I thought of using the "parent" field in the GlobalRdrEnv, but
      that's really used for import/export and just isn't right for this.
      For example, for import/export a field is a subordinate of the *type
      constructor* whereas here we need to know what fields belong to a
      particular *data* constructor.
      
      The main thing is that we need to map a data constructor to its
      fields, and we need to do so in the renamer.   For imported modules
      it's easy: just look in the imported TypeEnv.  For the module being
      compiled, we make a new field tcg_field_env in the TcGblEnv.
      The important functions are
      	RnEnv.lookupRecordBndr
      	RnEnv.lookupConstructorFields
      
      There is still a significant infelicity in the way the renamer
      works on patterns, which I'll tackle next.
      
      
      I also did quite a bit of refactoring in the representation of
      record fields (mainly in HsPat).***END OF DESCRIPTION***
      
      Place the long patch description above the ***END OF DESCRIPTION*** marker.
      The first line of this file will be the patch name.
      
      
      This patch contains the following changes:
      
      M ./compiler/deSugar/Check.lhs -3 +5
      M ./compiler/deSugar/Coverage.lhs -6 +7
      M ./compiler/deSugar/DsExpr.lhs -6 +13
      M ./compiler/deSugar/DsMeta.hs -8 +8
      M ./compiler/deSugar/DsUtils.lhs -1 +1
      M ./compiler/deSugar/MatchCon.lhs -2 +2
      M ./compiler/hsSyn/Convert.lhs -3 +3
      M ./compiler/hsSyn/HsDecls.lhs -9 +25
      M ./compiler/hsSyn/HsExpr.lhs -13 +3
      M ./compiler/hsSyn/HsPat.lhs -25 +63
      M ./compiler/hsSyn/HsUtils.lhs -3 +3
      M ./compiler/main/DynFlags.hs +6
      M ./compiler/parser/Parser.y.pp -13 +17
      M ./compiler/parser/RdrHsSyn.lhs -16 +18
      M ./compiler/rename/RnBinds.lhs -2 +2
      M ./compiler/rename/RnEnv.lhs -22 +82
      M ./compiler/rename/RnExpr.lhs -34 +12
      M ./compiler/rename/RnHsSyn.lhs -3 +2
      M ./compiler/rename/RnSource.lhs -50 +78
      M ./compiler/rename/RnTypes.lhs -50 +84
      M ./compiler/typecheck/TcExpr.lhs -18 +18
      M ./compiler/typecheck/TcHsSyn.lhs -20 +21
      M ./compiler/typecheck/TcPat.lhs -8 +6
      M ./compiler/typecheck/TcRnMonad.lhs -6 +15
      M ./compiler/typecheck/TcRnTypes.lhs -2 +11
      M ./compiler/typecheck/TcTyClsDecls.lhs -3 +4
      M ./docs/users_guide/flags.xml +7
      M ./docs/users_guide/glasgow_exts.xml +42
      2eb04ca0
  26. 02 May, 2007 1 commit
  27. 24 Apr, 2007 1 commit
    • Simon Marlow's avatar
      Breakpoints: get the names of the free variables right · 367b0590
      Simon Marlow authored
      Previously we relied on the names of the Ids attached to a tick being
      the same as the names of the original variables in the source code.
      Sometimes this worked, sometimes it didn't because the simplifier
      would inline away the Id.  So now we do this properly and retain the
      original OccNames from the source code for each breakpoint, and use
      these to construct the new Ids when we stop.
      
      Doing this involved moving the tracking of in-scope variables from the
      desugarer to the coverage pass.
      367b0590
  28. 17 Apr, 2007 1 commit
    • Simon Marlow's avatar
      Re-working of the breakpoint support · cdce6477
      Simon Marlow authored
      This is the result of Bernie Pope's internship work at MSR Cambridge,
      with some subsequent improvements by me.  The main plan was to
      
       (a) Reduce the overhead for breakpoints, so we could enable 
           the feature by default without incurrent a significant penalty
       (b) Scatter more breakpoint sites throughout the code
      
      Currently we can set a breakpoint on almost any subexpression, and the
      overhead is around 1.5x slower than normal GHCi.  I hope to be able to
      get this down further and/or allow breakpoints to be turned off.
      
      This patch also fixes up :print following the recent changes to
      constructor info tables.  (most of the :print tests now pass)
      
      We now support single-stepping, which just enables all breakpoints.
      
        :step <expr>     executes <expr> with single-stepping turned on
        :step            single-steps from the current breakpoint
      
      The mechanism is quite different to the previous implementation.  We
      share code with the HPC (haskell program coverage) implementation now.
      The coverage pass annotates source code with "tick" locations which
      are tracked by the coverage tool.  In GHCi, each "tick" becomes a
      potential breakpoint location.
      
      Previously breakpoints were compiled into code that magically invoked
      a nested instance of GHCi.  Now, a breakpoint causes the current
      thread to block and control is returned to GHCi.
      
      See the wiki page for more details and the current ToDo list:
      
        http://hackage.haskell.org/trac/ghc/wiki/NewGhciDebugger
      cdce6477
  29. 05 Feb, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Establish the CoreSyn let/app invariant · 7b01315d
      simonpj@microsoft.com authored
      This patch clears up a long-standing wart.   For some time it's been the
      case that 
      	the RHS of a non-recursive let can be unlifed iff 
      	the RHS is ok-for-speculation
      
      This patch extends the invariant to the argument of an App, and 
      establishes it by the smart constructors mkDsApp, mkDsApps in the desugarer.
      
      Once established, it should be maintained by the optimiser.
      
      This tides up some awkward cases, notably in exprIsHNF, and I think it
      fixes a outright strictness bug in Simplify.prepareRhs.
      7b01315d
  30. 04 Feb, 2007 1 commit
  31. 02 Feb, 2007 1 commit
  32. 31 Jan, 2007 1 commit
  33. 21 Dec, 2006 1 commit
    • lennart@augustsson.net's avatar
      Add support for overloaded string literals. · 90dc9026
      lennart@augustsson.net authored
      The class is named IsString with the single method fromString.
      Overloaded strings work the same way as overloaded numeric literals.
      In expressions a string literals gets a fromString applied to it.
      In a pattern there will be an equality comparison with the fromString:ed literal.
      
      Use -foverloaded-strings to enable this extension.
       
      90dc9026
  34. 10 Dec, 2006 3 commits
  35. 24 Oct, 2006 1 commit
    • andy@galois.com's avatar
      Haskell Program Coverage · d5934bbb
      andy@galois.com authored
      This large checkin is the new ghc version of Haskell
      Program Coverage, an expression-level coverage tool for Haskell.
      
      Parts:
      
       - Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files.
       - Coverage.lhs - Annotates the HsSyn with coverage tickboxes.
        - New Note's in Core,
            - TickBox      -- ticked on entry to sub-expression
            - BinaryTickBox  -- ticked on exit to sub-expression, depending
      	       	     -- on the boolean result.
      
        - New Stg level TickBox (no BinaryTickBoxes, though) 
      
      You can run the coverage tool with -fhpc at compile time. 
      Main must be compiled with -fhpc. 
      				      
      d5934bbb
  36. 11 Oct, 2006 1 commit
    • Simon Marlow's avatar
      Module header tidyup, phase 1 · 49c98d14
      Simon Marlow authored
      This patch is a start on removing import lists and generally tidying
      up the top of each module.  In addition to removing import lists:
      
         - Change DATA.IOREF -> Data.IORef etc.
         - Change List -> Data.List etc.
         - Remove $Id$
         - Update copyrights
         - Re-order imports to put non-GHC imports last
         - Remove some unused and duplicate imports
      49c98d14
  37. 29 Sep, 2006 1 commit