1. 02 Jul, 2007 2 commits
  2. 30 Jun, 2007 1 commit
  3. 28 Jun, 2007 1 commit
  4. 27 Jun, 2007 1 commit
  5. 25 Jun, 2007 1 commit
  6. 21 Jun, 2007 3 commits
    • simonpj@microsoft.com's avatar
      -fglasgow-exts implies -X=GADTs · 5e8d76a6
      simonpj@microsoft.com authored
      5e8d76a6
    • 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
    • simonpj@microsoft.com's avatar
      bec55bc5
  7. 20 Jun, 2007 4 commits
    • simonpj@microsoft.com's avatar
    • simonpj@microsoft.com's avatar
      Use -X for language extensions · 5e05865d
      simonpj@microsoft.com authored
      We've often talked about having a separate flag for language extensions,
      and now we have one. You can say
      
      	-XImplicitParams
      	-X=ImplicitParams
      	-Ximplicit-params
      
      as you like.  These replace the "-f" flags with similar names (though
      the -f prefix will serve as a synonym for -X for a while).  
      
      There's an optional "=", and the flag is normalised by removing hyphens
      and lower-casing, so all the above variants mean the same thing.
      
      The nomenclature is intended to match the LANGUAGE pramgas, which are
      defined by Cabal.  So you can also say
      
      	{-# LANGUAGE ImplicitParams #-}
      
      But Cabal doesn't have as many language options as GHC does, so the -X
      things are a superset of the LANGUAGE things.
      
      The optional "=" applies to all flags that take an argument, so you can,
      for example, say
      	
      	-pgmL=/etc/foo
      
      I hope that's ok.  (It's an unforced change; just fitted in.)
      
      I hope we'll add more -X flags, to replace the portmanteau -fglasgow-exts 
      which does everything!  
      
      I have updated the manual, but doubtless missed something.
      
      
      5e05865d
    • andy@galois.com's avatar
      d85714eb
    • andy@galois.com's avatar
      Turning off case liberation when using the hpc option, for now · d363c1fc
      andy@galois.com authored
      Consider the following code
      
           f = g (case v of
                    V a b -> a : t f)
      
      where g is expensive. Liberate case will turn this into
      
           f = g (case v of
                   V a b -> a : t (letrec f = g (case v of
                                                 V a b -> a : f t)
                                    in f)
                 )
      
      Yikes! We evaluate g twice. This leads to a O(2^n) explosion
      if g calls back to the same code recursively.
      
      This happen sometimes in HPC, because every tick is a liberate-able case,
      but is a general problem to case liberation (I think). 
      d363c1fc
  8. 12 Jun, 2007 1 commit
    • Ian Lynagh's avatar
      Tweak banner printing · cedd4187
      Ian Lynagh authored
      * -{short,long}-ghci-banner are now dynamic options, so you can put
        ":set -short-ghci-banner" in .ghci
      * The -v2 banner information now always tells you what compiler booted GHC,
        and what stage the compiler is. Thus we no longer assume that stage > 1
        iff GHCI is defined.
      cedd4187
  9. 15 May, 2007 1 commit
    • Simon Marlow's avatar
      GHCi debugger: new flag -fbreak-on-exception · 17f848e1
      Simon Marlow authored
      When -fbreak-on-exception is set, an exception will cause GHCi to
      suspend the current computation and return to the prompt, where the
      history of the current evaluation can be inspected (if we are in
      :trace).  This isn't on by default, because the behaviour could be
      confusing: for example, ^C will cause a breakpoint.  It can be very
      useful for finding the cause of a "head []" or a "fromJust Nothing",
      though.
      17f848e1
  10. 14 May, 2007 1 commit
  11. 11 May, 2007 1 commit
  12. 07 May, 2007 1 commit
  13. 04 May, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Make -frewrite-rules into a dynamic flag; off for -O0 · 5943ce90
      simonpj@microsoft.com authored
      Argubly rewrite rules should not fire with -O0, and it turns
      out that when compiling GHC.Base with -O0 we get a crash if
      the rewrite rules do fire (see Note [Scoping for Builtin rules]
      in PrelRules).
      
      So unless someone yells, rewrite rules are off with -O0.
      
      The new (now dynamic) flag is 
          -frewrite rules (with -fno-rewrite-rules to disable)
      
      The old (static) flag -frules-off is gone.
      5943ce90
  14. 29 Apr, 2007 1 commit
  15. 25 Apr, 2007 1 commit
  16. 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
  17. 11 Apr, 2007 1 commit
    • Simon Marlow's avatar
      Rationalise GhcMode, HscTarget and GhcLink · 3c22606b
      Simon Marlow authored
      This patch cleans up the GHC API, and adds some functionality: we can
      now compile to object code inside GHCi.
      
      Previously we had:
      
        data GhcMode
          = BatchCompile
          | Interactive
          | OneShot
          | JustTypecheck
          | MkDepend
        
        data HscTarget
          = HscC
          | HscAsm
          | HscJava
          | HscInterpreted
          | HscNothing
      
      There was redundancy here; if GhcMode is Interactive, then only
      HscInterpreted makes sense, and JustTypecheck required HscNothing.
      Now we have:
      
        data GhcMode
          = CompManager       -- ^ --make, GHCi, etc.
          | OneShot           -- ^ ghc -c Foo.hs
          | MkDepend          -- ^ ghc -M, see Finder for why we need this
      
      and HscTarget remains as before.
      
      Previously GhcLink looked like this:
      
        data GhcLink = NoLink | StaticLink
      
      Now we have:
      
        data GhcLink = NoLink | LinkBinary | LinkInMemory
      
      The idea being that you can have an HscTarget of HscAsm (for example)
      and still link in memory.
      
      There are two new flags:
      
        -fobject-code selects object code as the target (selects
                      either -fasm or -fvia-C, whichever is the default)
                      This can be usd with ':set' in GHCi, or on the command line.
      
        -fbyte-code   sets byte-code as the target.  Only works in GHCi.
                      One day maybe this could save the byte code in a file
                      when used outside GHCi.
      
        (names chosen for consistency with -fno-code).
      
      Changes to the GHC API: newSession no longer takes the GhcMode
      argument.  The GhcMode defaults to CompManager, which is usually what
      you want.  To do JustTypecheck now, just set hscTarget to HscNothing.
      3c22606b
  18. 22 Mar, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Add -ddump-mod-cycles to -M behaviour · a896a832
      simonpj@microsoft.com authored
      This patch adds a flag -ddump-mod-cycles to the "ghc -M" dependency analyser.
      
      The effect of
      	ghc -M -ddump-mod-cycles
      is to dump a list of cycles foud in the module graph.  The display is
      trimmed so that only dependencies within the cycle are shown; and the
      list of modules in a cycle is itself sorted into dependency order, so that
      it is easy to track the chain of dependencies.
      
      Open question: should the flag be "-ddump-mod-cycles" or "-optdep-dump-mod-cycles"?  For this reason I have not yet added to the documentation.
      a896a832
  19. 09 Feb, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Major improvement to SpecConstr · cac2aca1
      simonpj@microsoft.com authored
      This patch improves the SpecConstr pass, by 
        a) making it work with join points
        b) making it generate specialisations transitively
      
      As part of it, SpecConstr now carries a substitution with it, which
      runs over the whole program as it goes.  This turned out to be 
      a big win; simplified the implementation quite a bit.
      
      I have *disabled* the specialisation on lambdas; it's pretty fragile,
      and sometimes generates more and more specialisations. Something to
      come back to, perhaps.
      
      I rejigged the flag-handling a bit.  Now the specification of passes
      in DynFlags is a bit nicer; see
      	- optLevelFlags top-level data structure
      	- runWhen function
      	- CoreDoPasses constructor
      
      There are now command-line flags
      	-fspec-constr
      	-fliberate-case
      	-fspec-threshold=N
      which do the obvious thing.  -O2 switches on both spec-constr and liberate-case.
      You can use -fno-liberate-case, -fno-spec-constr after -O2 to switch them off again.
      
      The spec-threshold applies to both these transformations; default value 200 for now.
      
      
      
      
      cac2aca1
  20. 07 Feb, 2007 2 commits
  21. 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
  22. 12 Jan, 2007 1 commit
  23. 11 Jan, 2007 2 commits
  24. 09 Jan, 2007 1 commit
  25. 16 Dec, 2006 1 commit
  26. 11 Dec, 2006 2 commits
  27. 10 Dec, 2006 2 commits
  28. 09 Dec, 2006 1 commit
  29. 01 Dec, 2006 1 commit
    • wolfgang.thaller@gmx.net's avatar
      Decouple -O from -fvia-C · 8971f720
      wolfgang.thaller@gmx.net authored
      Nowadays, there are situations where -fvia-C is definitely unwanted, such
      as when -fPIC is used on some platforms, so we do not want implicit -fvia-C
      any more.
      8971f720
  30. 29 Nov, 2006 1 commit
    • andy@galois.com's avatar
      TickBox representation change · 8100cd43
      andy@galois.com authored
      This changes the internal representation of TickBoxes,
      from
              Note (TickBox "module" n)  <expr>
      into
      
              case tick<module,n> of
                _ -> <expr>
      
      tick has type :: #State #World, when the module and tick numbe
      are stored inside IdInfo.
      
      Binary tick boxes change from
      
               Note (BinaryTickBox "module" t f) <expr>
      
      into
      
                btick<module,t,f> <expr>
      
      btick has type :: Bool -> Bool, with the module and tick number
      stored inside IdInfo.
      8100cd43