1. 07 Nov, 2015 1 commit
    • Simon Marlow's avatar
      Make GHCi & TH work when the compiler is built with -prof · ce1f1607
      Simon Marlow authored
      Summary:
      Amazingly, there were zero changes to the byte code generator and very
      few changes to the interpreter - mainly because we've used good
      abstractions that hide the differences between profiling and
      non-profiling.  So that bit was pleasantly straightforward, but there
      were a pile of other wibbles to get the whole test suite through.
      
      Note that a compiler built with -prof is now like one built with
      -dynamic, in that to use TH you have to build the code the same way.
      For dynamic, we automatically enable -dynamic-too when TH is required,
      but we don't have anything equivalent for profiling, so you have to
      explicitly use -prof when building code that uses TH with a profiled
      compiler.  For this reason Cabal won't work with TH.  We don't expect
      to ship a profiled compiler, so I think that's OK.
      
      Test Plan: validate with GhcProfiled=YES in validate.mk
      
      Reviewers: goldfire, bgamari, rwbarton, austin, hvr, erikd, ezyang
      
      Reviewed By: ezyang
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1407
      
      GHC Trac Issues: #4837, #545
      ce1f1607
  2. 20 Oct, 2015 1 commit
    • Jan Stolarek's avatar
      Reject top-level typed TH splices. Fixes #10945 · 1750ebc2
      Jan Stolarek authored
      When TemplateHaskell language extension is enabled it is valid to have
      top-level expressions.  Each such expression is treated as a contents
      of a splice.  The problem arises with typed splices.  They are not valid
      at the top level and therefore we should interpret them not as a splice
      but as a top-level expression (aka. implicit splice).  So saying:
      
      $$foo
      
      is equivalent of:
      
      $( $$foo )
      
      This patch makes sure that this is indeed the case.  Until now we
      incorrectly treated typed splices as explicit splices.
      1750ebc2
  3. 16 Oct, 2015 1 commit
  4. 13 Oct, 2015 1 commit
    • Ryan Scott's avatar
      Make dataToQa aware of Data instances which use functions to implement toConstr · d2f9972a
      Ryan Scott authored
      Trac #10796 exposes a way to make `template-haskell`'s `dataToQa` function
      freak out if using a `Data` instance that produces a `Constr` (by means of
      `toConstr`) using a function name instead of a data constructor name. While
      such `Data` instances are somewhat questionable, they are nevertheless present
      in popular libraries (e.g., `containers`), so we can at least make `dataToQa`
      aware of their existence.
      
      In order to properly distinguish strings which represent variables (as opposed
      to data constructors), it was necessary to move functionality from `Lexeme` (in
      `ghc`) to `GHC.Lexeme` in a new `ghc-boot` library (which was previously named
      `bin-package-db`).
      
      Reviewed By: goldfire, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1313
      
      GHC Trac Issues: #10796
      d2f9972a
  5. 08 Oct, 2015 1 commit
  6. 26 Sep, 2015 1 commit
    • Ömer Sinan Ağacan's avatar
      reify associated types when reifying typeclasses(#10891) · b4d43b4e
      Ömer Sinan Ağacan authored
      As reported in Trac #10891, Template Haskell's `reify` was not
      generating Decls for associated types. This patch fixes that.
      
      Note that even though `reifyTyCon` function used in this patch returns
      some type instances, I'm ignoring that.
      
      Here's an example of how associated types are encoded with this patch:
      
      (Simplified representation)
      
          class C a where
            type F a :: *
      
          -->
      
          OpenTypeFamilyD "F" ["a"]
      
      With default type instances:
      
          class C a where
            type F a :: *
            type F a = a
      
          -->
      
          OpenTypeFamilyD "F" ["a"]
          TySynInstD "F" (TySynEqn [VarT "a"] "a")
      
      Test Plan:
      This patch was already reviewed and even merged. The patch is later
      reverted because apparently it broke the build some time between the
      validation of this patch and merge. Creating this new ticket to fix the
      validation.
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1277
      
      GHC Trac Issues: #10891
      b4d43b4e
  7. 23 Sep, 2015 3 commits
  8. 22 Sep, 2015 1 commit
  9. 21 Sep, 2015 2 commits
  10. 17 Sep, 2015 1 commit
    • Ryan Scott's avatar
      Add namePackage function to template-haskell · 77662e13
      Ryan Scott authored
      Currently there exists a nameBase function (for retrieving a Name's OccName)
      and a nameModule function (for retrieving a Name's ModName), but there is no
      counterpart for PkgNames.
      
      This would be useful for implementing Template Haskell features which need
      to have easy access to a Name's package (e.g., automatically derived Lift
      instances).
      
      Reviewed By: goldfire, austin, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1237
      77662e13
  11. 03 Sep, 2015 1 commit
  12. 05 Aug, 2015 1 commit
    • Ryan Scott's avatar
      Add Fixity info for infix types · 575abf42
      Ryan Scott authored
      Template Haskell allows reification of fixity for infix functions and
      data constructors, and not for infix types. This adds a `Fixity` field
      to the relevant `Info` constructors that can have infix types (`ClassI`,
      `TyConI`, and `FamilyI`).
      
      I don't think that `VarI` or `PrimTyConI` can be infix, but I could be
      wrong.
      
      Test Plan: ./validate
      
      Reviewers: austin, goldfire, bgamari
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1109
      
      GHC Trac Issues: #10704
      575abf42
  13. 20 Jul, 2015 1 commit
  14. 16 Jul, 2015 1 commit
    • RyanGlScott's avatar
      Handle Char#, Addr# in TH quasiquoter (fixes #10620) · 2c9de9c9
      RyanGlScott authored
      DsMeta does not attempt to handle quasiquoted Char# or Addr# values,
      which causes expressions like `$([| 'a'# |])` or `$([| "abc"# |])` to
      fail
      with an `Exotic literal not (yet) handled by Template Haskell` error.
      
      To fix this, the API of `template-haskell` had to be changed so that
      `Lit`
      now has an extra constructor `CharPrimL` (a `StringPrimL` constructor
      already
      existed, but it wasn't used). In addition, `DsMeta` has to manipulate
      `CoreExpr`s directly that involve `Word8`s. In order to do this,
      `Word8` had
      to be added as a wired-in type to `TysWiredIn`.
      
      Actually converting from `HsCharPrim` and `HsStringPrim` to `CharPrimL`
      and
      `StringPrimL`, respectively, is pretty straightforward after that, since
      both `HsCharPrim` and `CharPrimL` use `Char` internally, and
      `HsStringPrim`
      uses a `ByteString` internally, which can easily be converted to
      `[Word8]`,
      which is what `StringPrimL` uses.
      
      Reviewers: goldfire, austin, simonpj, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1054
      
      GHC Trac Issues: #10620
      2c9de9c9
  15. 13 Jul, 2015 1 commit
  16. 07 Jul, 2015 1 commit
  17. 26 May, 2015 1 commit
  18. 11 May, 2015 1 commit
    • Edward Z. Yang's avatar
      Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382. · f16ddcee
      Edward Z. Yang authored
      Summary:
      This commit adds stage 1 support for Template Haskell
      quoting, e.g. [| ... expr ... |], which is useful
      for authors of quasiquoter libraries that do not actually
      need splices.  The TemplateHaskell extension now does not
      unconditionally fail; it only fails if the renamer encounters
      a splice that it can't run.
      
      In order to make sure the referenced data structures
      are consistent, template-haskell is now a boot library.
      There are some minor BC changes to template-haskell to make it boot
      on GHC 7.8.
      
      Note for reviewer: big diff changes are simply code
      being moved out of an ifdef; there was no other substantive
      change to that code.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, goldfire
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D876
      
      GHC Trac Issues: #10382
      f16ddcee
  19. 09 May, 2015 2 commits
  20. 04 May, 2015 2 commits
  21. 03 Apr, 2015 1 commit
  22. 10 Mar, 2015 1 commit
    • Edward Z. Yang's avatar
      Refactor testsuite with normalise_version() · 8cbd7f5d
      Edward Z. Yang authored
      Summary:
      This function generalizes the normaliseBytestringPackage and other similar
      one-off functions into normalise_version() with takes a package name to
      normalize against.  This JUST manages package versions; we also could use
      a normalize for keys.
      
      In the process, I modified all the normalization functions to be accumulative;
      I don't think this makes a difference for current test cases but I think it
      makes things nicer.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Reviewers: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D725
      8cbd7f5d
  23. 11 Feb, 2015 1 commit
    • Simon Peyton Jones's avatar
      nameIsLocalOrFrom should include interactive modules · 6ff3db92
      Simon Peyton Jones authored
      The provoking cause was Trac #10019, but it revealed that nameIsLocalOrFrom
      should really include all interactive modules (ones from the 'interactive'
      package).  Previously we had some ad-hoc 'isInteractiveModule' tests with
      some (but not all) the calls to nameIsLocalOrFrom.
      
      See the new comments with Name.nameIsLocalOrFrom.
      6ff3db92
  24. 10 Feb, 2015 1 commit
    • Simon Peyton Jones's avatar
      Refactor the handling of quasi-quotes · f46360ed
      Simon Peyton Jones authored
      As Trac #10047 points out, a quasi-quotation [n|...blah...|] is supposed
      to behave exactly like $(n "...blah...").  But it doesn't!  This was outright
      wrong: quasiquotes were being run even inside brackets.
      
      Now that TH supports both typed and untyped splices, a quasi-quote is properly
      regarded as a particular syntax for an untyped splice. But apart from that
      they should be treated the same.  So this patch refactors the handling of
      quasiquotes to do just that.
      
      The changes touch quite a lot of files, but mostly in a routine way.
      The biggest changes by far are in RnSplice, and more minor changes in
      TcSplice.  These are the places where there was real work to be done.
      Everything else is routine knock-on changes.
      
      * No more QuasiQuote forms in declarations, expressions, types, etc.
        So we get rid of these data constructors
          * HsBinds.QuasiQuoteD
          * HsExpr.HsSpliceE
          * HsPat.QuasiQuotePat
          * HsType.HsQuasiQuoteTy
      
      * We get rid of the HsQuasiQuote type altogether
      
      * Instead, we augment the HsExpr.HsSplice type to have three
        consructors, for the three types of splice:
          * HsTypedSplice
          * HsUntypedSplice
          * HsQuasiQuote
        There are some related changes in the data types in HsExpr near HsSplice.
        Specifically: PendingRnSplice, PendingTcSplice, UntypedSpliceFlavour.
      
      * In Hooks, we combine rnQuasiQuoteHook and rnRnSpliceHook into one.
        A smaller, clearer interface.
      
      * We have to update the Haddock submodule, to accommodate the hsSyn changes
      f46360ed
  25. 13 Jan, 2015 1 commit
    • GregWeber's avatar
      add -th-file which generates a th.hs file · 07ace5c2
      GregWeber authored
      Summary:
      see Trac #8624
      
      similar functionality is now available
      with -ddump-to-file -ddump-splices
      
      However, users are already accustomed to -ddump-splices
      having a particular format, and this format is not completely valid code
      The goal of -th-file is to dump valid Haskell code
      
      Additionally, the convention of -ddump-to-file is to name the file after
      the flag, so the file is .dump-splices
      Given that the goal of the new flag is to generate valid Haskell,
      The extension should be .hs
      
      Additionally, -ddump-to-file effects all other dump flags
      
      Test Plan:
      look at the output of using the -th-file flag
      and compare it to the output of using -ddump-to-file and -ddump-splices
      I want to add test cases, but just need some pointers on getting started there
      
      Reviewers: thomie, goldfire, simonpj, austin
      
      Reviewed By: simonpj, austin
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D518
      
      GHC Trac Issues: #8624
      07ace5c2
  26. 19 Dec, 2014 1 commit
  27. 10 Dec, 2014 1 commit
  28. 24 Nov, 2014 1 commit
  29. 21 Nov, 2014 7 commits