1. 16 Jan, 2015 1 commit
    • Alan Zimmerman's avatar
      API Annotations tweaks. · 11881ec6
      Alan Zimmerman authored
      HsTyLit now has SourceText
      Update documentation of HsSyn to reflect which annotations are attached to which element.
      Ensure that the parser always keeps HsSCC and HsTickPragma values, to
      be ignored in the desugar phase if not needed
      Bringing in SourceText for pragmas
      Add Location in NPlusKPat
      Add Location in FunDep
      Make RecCon payload Located
      Explicitly add AnnVal to RdrName where it is compound
      Add Location in IPBind
      Add Location to name in IEThingAbs
      Add Maybe (Located id,Bool) to Match to track fun_id,infix
        This includes converting Match into a record and adding a note about why
        the fun_id needs to be replicated in the Match.
      Add Location in KindedTyVar
      Sort out semi-colons for parsing
        - import statements
        - stmts
        - decls
        - decls_cls
        - decls_inst
      This updates the haddock submodule.
      Test Plan: ./validate
      Reviewers: hvr, austin, goldfire, simonpj
      Reviewed By: simonpj
      Subscribers: thomie, carter
      Differential Revision: https://phabricator.haskell.org/D538
  2. 16 Dec, 2014 1 commit
    • Peter Wortmann's avatar
      Source notes (Core support) · 993975d3
      Peter Wortmann authored
      This patch introduces "SourceNote" tickishs that link Core to the
      source code that generated it. The idea is to retain these source code
      links throughout code transformations so we can eventually relate
      object code all the way back to the original source (which we can,
      say, encode as DWARF information to allow debugging).  We generate
      these SourceNotes like other tickshs in the desugaring phase. The
      activating command line flag is "-g", consistent with the flag other
      compilers use to decide DWARF generation.
      Keeping ticks from getting into the way of Core transformations is
      tricky, but doable. The changes in this patch produce identical Core
      in all cases I tested -- which at this point is GHC, all libraries and
      nofib. Also note that this pass creates *lots* of tick nodes, which we
      reduce somewhat by removing duplicated and overlapping source
      ticks. This will still cause significant Tick "clumps" - a possible
      future optimization could be to make Tick carry a list of Tickishs
      instead of one at a time.
      (From Phabricator D169)
  3. 03 Dec, 2014 1 commit
  4. 18 Nov, 2014 1 commit
  5. 04 Nov, 2014 1 commit
  6. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
  7. 13 Nov, 2013 1 commit
  8. 30 Jan, 2013 1 commit
  9. 22 Jun, 2012 1 commit
    • Ian Lynagh's avatar
      Remove some uses of sortLe · 0043f07a
      Ian Lynagh authored
      Technically the behaviour of sortWith has changed, as it used
          x `le` y = get_key x < get_key y
      (note "<" rather than "<="), but I assume that that was just a mistake.
  10. 11 Jun, 2012 2 commits
  11. 20 Apr, 2012 1 commit
    • Simon Peyton Jones's avatar
      Do SCC on instance declarations (fixes Trac #5715) · fa9fdc28
      Simon Peyton Jones authored
      The trouble here is that given
          {-# LANGUAGE DataKinds, TypeFamilies #-}
          data instance Foo a = Bar (Bar a)
      we want to get a sensible message that we can't use the promoted 'Bar'
      constructor until after its definition; it's a staging error.  Bud the
      staging mechanism that we use for vanilla data declarations don't work
      Solution is to perform strongly-connected component analysis on the
      instance declarations. But that in turn means that we need to track
      free-variable information on more HsSyn declarations, which is why
      so many files are touched.  All the changes are boiler-platey except
      the ones in TcInstDcls.
  12. 04 Nov, 2011 1 commit
  13. 25 Oct, 2011 1 commit
  14. 06 Sep, 2011 1 commit
    • batterseapower's avatar
      Implement -XConstraintKind · 9729fe7c
      batterseapower authored
      Basically as documented in http://hackage.haskell.org/trac/ghc/wiki/KindFact,
      this patch adds a new kind Constraint such that:
        Show :: * -> Constraint
        (?x::Int) :: Constraint
        (Int ~ a) :: Constraint
      And you can write *any* type with kind Constraint to the left of (=>):
      even if that type is a type synonym, type variable, indexed type or so on.
      The following (somewhat related) changes are also made:
       1. We now box equality evidence. This is required because we want
          to give (Int ~ a) the *lifted* kind Constraint
       2. For similar reasons, implicit parameters can now only be of
          a lifted kind. (?x::Int#) => ty is now ruled out
       3. Implicit parameter constraints are now allowed in superclasses
          and instance contexts (this just falls out as OK with the new
          constraint solver)
      Internally the following major changes were made:
       1. There is now no PredTy in the Type data type. Instead
          GHC checks the kind of a type to figure out if it is a predicate
       2. There is now no AClass TyThing: we represent classes as TyThings
          just as a ATyCon (classes had TyCons anyway)
       3. What used to be (~) is now pretty-printed as (~#). The box
          constructor EqBox :: (a ~# b) -> (a ~ b)
       4. The type LCoercion is used internally in the constraint solver
          and type checker to represent coercions with free variables
          of type (a ~ b) rather than (a ~# b)
  15. 02 Sep, 2011 1 commit
    • Simon Peyton Jones's avatar
      Some minor wibbling in printing source locations · 0ccf2c3b
      Simon Peyton Jones authored
      I found that an imported instance was getting printed with <no
      location info>.  Fixing this pushed me into a bit more refactoring
      than I intended, but it's all small aesthetic stuff, nothing
      fundamental.  Caused some error message to change as a result.
      I removed pprDefnLoc from the GHC API because it doesn't seem to be
      used.  Name.pprNamedefnLoc and pprDefinedAt are probably more useful
  16. 11 Jun, 2011 1 commit
    • Simon Peyton Jones's avatar
      Add -fno-omit-interface-pragmas to SrcLoc, to work around Trac #5252 · 8fb9d669
      Simon Peyton Jones authored
      We have to do this until the earliest bootstrap compiler
      has fixed #5252.  It's no big deal; it just means that
      SrcLoc.hi has lots of stuff even when compiling GHC without -O.
      Lacking this, you get
        (GHC version 7.0.3 for i386-unknown-mingw32):
      	reboxProduct: not a product ghc-7.1:SrcLoc.RealSrcLoc{tc r8J}
  17. 09 Jun, 2011 1 commit
    • Ian Lynagh's avatar
      Refactor SrcLoc and SrcSpan · b2bd63f9
      Ian Lynagh authored
      The "Unhelpful" cases are now in a separate type. This allows us to
      improve various things, e.g.:
      * Most of the panic's in SrcLoc are now gone
      * The Lexer now works with RealSrcSpans rather than SrcSpans, i.e. it
        knows that it has real locations and thus can assume that the line
        number etc really exists
      * Some of the more suspicious cases are no longer necessary, e.g.
        we no longer need this case in advanceSrcLoc:
            advanceSrcLoc loc _ = loc -- Better than nothing
      More improvements can probably be made, e.g. tick locations can
      probably use RealSrcSpans too.
  18. 24 Apr, 2011 1 commit
  19. 31 Mar, 2011 1 commit
  20. 27 Oct, 2010 1 commit
    • Simon Marlow's avatar
      Refactoring and tidyup of HscMain and related things (also fix #1666) · 94bf0d36
      Simon Marlow authored
      While trying to fix #1666 (-Werror aborts too early) I decided to some
      tidyup in GHC/DriverPipeline/HscMain.
       - The GhcMonad overloading is gone from DriverPipeline and HscMain
         now.  GhcMonad is now defined in a module of its own, and only
         used in the top-level GHC layer.  DriverPipeline and HscMain
         use the plain IO monad and take HscEnv as an argument.
       - WarnLogMonad is gone.  printExceptionAndWarnings is now called
         printException (the old name is deprecated).  Session no longer
         contains warnings.
       - HscMain has its own little monad that collects warnings, and also
         plumbs HscEnv around.  The idea here is that warnings are collected
         while we're in HscMain, but on exit from HscMain (any function) we
         check for warnings and either print them (via log_action, so IDEs
         can still override the printing), or turn them into an error if
         -Werror is on.
       - GhcApiCallbacks is gone, along with GHC.loadWithLogger.  Thomas
         Schilling told me he wasn't using these, and I don't see a good
         reason to have them.
       - there's a new pure API to the parser (suggestion from Neil Mitchell):
            parser :: String
                   -> DynFlags
                   -> FilePath
                   -> Either ErrorMessages (WarningMessages, 
                                            Located (HsModule RdrName))
  21. 15 Oct, 2010 1 commit
  22. 15 Sep, 2010 1 commit
  23. 30 Mar, 2010 1 commit
  24. 17 Dec, 2009 1 commit
  25. 29 Nov, 2009 1 commit
  26. 28 Nov, 2009 2 commits
  27. 27 Nov, 2009 1 commit
  28. 20 Aug, 2009 1 commit
  29. 10 Nov, 2008 1 commit
  30. 20 Oct, 2008 1 commit
  31. 26 Aug, 2008 2 commits
  32. 31 Jul, 2008 1 commit
  33. 12 Apr, 2008 1 commit
  34. 25 Jan, 2008 1 commit
  35. 20 Jan, 2008 1 commit
  36. 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.
      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
  37. 03 Oct, 2007 1 commit