1. 23 Sep, 2015 2 commits
    • Ömer Sinan Ağacan's avatar
      reify associated types when reifying typeclasses · 5c115236
      Ö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")
      
      Reviewed By: goldfire
      
      Differential Revision: https://phabricator.haskell.org/D1254
      
      GHC Trac Issues: #10891
      5c115236
    • Austin Seipp's avatar
      testsuite: attempt fixing fallout from 089b72f5 · 79f57325
      Austin Seipp authored
      A few tests had the same name which is a big no-no, so I reorganized them a
      little. The naming is somewhat haphazard, though...
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      79f57325
  2. 22 Sep, 2015 1 commit
  3. 21 Sep, 2015 2 commits
  4. 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
  5. 03 Sep, 2015 1 commit
  6. 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
  7. 20 Jul, 2015 1 commit
  8. 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
  9. 13 Jul, 2015 1 commit
  10. 07 Jul, 2015 1 commit
  11. 26 May, 2015 1 commit
  12. 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
  13. 09 May, 2015 2 commits
  14. 04 May, 2015 2 commits
  15. 03 Apr, 2015 1 commit
  16. 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
  17. 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
  18. 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
  19. 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
  20. 19 Dec, 2014 1 commit
  21. 10 Dec, 2014 1 commit
  22. 24 Nov, 2014 1 commit
  23. 21 Nov, 2014 7 commits
  24. 20 Nov, 2014 3 commits
  25. 12 Nov, 2014 4 commits