Skip to content
Snippets Groups Projects
  1. Mar 10, 2017
  2. Jan 26, 2017
  3. Dec 17, 2016
  4. Oct 01, 2016
    • Ryan Scott's avatar
      Implement deriving strategies · 9e862765
      Ryan Scott authored
      Allows users to explicitly request which approach to `deriving` to use
      via keywords, e.g.,
      
      ```
      newtype Foo = Foo Bar
        deriving Eq
        deriving stock    Ord
        deriving newtype Show
      ```
      
      Fixes #10598. Updates haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: hvr, kosmikus, goldfire, alanz, bgamari, simonpj, austin,
      erikd, simonmar
      
      Reviewed By: alanz, bgamari, simonpj
      
      Subscribers: thomie, mpickering, oerjan
      
      Differential Revision: https://phabricator.haskell.org/D2280
      
      GHC Trac Issues: #10598
      9e862765
  5. Aug 29, 2016
  6. Aug 23, 2016
    • Ryan Scott's avatar
      Template Haskell support for unboxed sums · 613d7455
      Ryan Scott authored
      This adds new constructors `UnboxedSumE`, `UnboxedSumT`, and
      `UnboxedSumP` to represent unboxed sums in Template Haskell.
      
      One thing you can't currently do is, e.g., `reify ''(#||#)`, since I
      don't believe unboxed sum type/data constructors can be written in
      prefix form.  I will look at fixing that as part of #12514.
      
      Fixes #12478.
      
      Test Plan: make test TEST=T12478_{1,2,3}
      
      Reviewers: osa1, goldfire, austin, bgamari
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2448
      
      GHC Trac Issues: #12478
      613d7455
  7. May 12, 2016
  8. Apr 17, 2016
  9. Jan 13, 2016
  10. Jan 06, 2016
  11. Dec 30, 2015
  12. Dec 29, 2015
  13. Dec 22, 2015
    • Simon Peyton Jones's avatar
      Refactor named wildcards (again) · 575a98e4
      Simon Peyton Jones authored
      Michal's work on #10982, #11098, refactored the handling of named
      wildcards by making them more like ordinary type variables.
      
      This patch takes the same idea to its logical conclusion, resulting
      in a much tidier, tighter implementation.
      
      Read Note [The wildcard story for types] in HsTypes.
      
      Changes:
      
       * Named wildcards are ordinary type variables, throughout
      
       * HsType no longer has a data constructor for named wildcards
         (was NamedWildCard in HsWildCardInfo).  Named wildcards are
         simply HsTyVars
      
       * Similarly named wildcards disappear from Template Haskell
      
       * I refactored RnTypes to avoid polluting LocalRdrEnv with something
         as narrow as named wildcards.  Instead the named wildcard set is
         carried in RnTyKiEnv.
      
      There is a submodule update for Haddock.
      575a98e4
    • Ryan Scott's avatar
      Rework Template Haskell's handling of strictness · f975b0b1
      Ryan Scott authored
      Currently, Template Haskell's treatment of strictness is not enough to
      cover all possible combinations of unpackedness and strictness. In
      addition, it isn't equipped to deal with new features (such as
      `-XStrictData`) which can change a datatype's fields' strictness during
      compilation.
      
      To address this, I replaced TH's `Strict` datatype with
      `SourceUnpackedness` and `SourceStrictness` (which give the programmer a
      more complete toolkit to configure a datatype field's strictness than
      just `IsStrict`, `IsLazy`, and `Unpack`). I also added the ability to
      reify a constructor fields' strictness post-compilation through the
      `reifyConStrictness` function.
      
      Fixes #10697.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, goldfire, bgamari, austin
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1603
      
      GHC Trac Issues: #10697
      f975b0b1
  14. Dec 21, 2015
  15. Dec 14, 2015
    • Ben Gamari's avatar
      Use Cxt for deriving clauses in TH (#10819) · 04ab55d9
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      Summary:
      Deriving clauses in the TH representations of data, newtype, data
      instance, and newtype instance declarations previously were just [Name],
      which didn't allow for more complex derived classes, eg. multi-parameter
      typeclasses.
      
      This switches out [Name] for Cxt, representing the derived classes as
      types instead of names.
      
      Test Plan: validate
      
      Reviewers: goldfire, spinda, austin
      
      Reviewed By: goldfire, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1202
      
      GHC Trac Issues: #10819
      04ab55d9
  16. Dec 12, 2015
  17. Oct 16, 2015
  18. Sep 03, 2015
  19. Jul 27, 2015
    • spinda's avatar
      Add UInfixT to TH types (fixes #10522) · 21782739
      spinda authored and Ben Gamari's avatar Ben Gamari committed
      UInfixT is like UInfixE or UInfixP but for types. Template Haskell
      splices can use it to punt fixity handling to GHC when constructing
      types.
      
      UInfixT is converted in compiler/hsSyn/Convert to a right-biased tree of
      HsOpTy, which is already rearranged in compiler/rename/RnTypes to match
      operator fixities.
      
      This patch consists of (1) adding UInfixT to the AST, (2) implementing
      the conversion and updating relevant comments, (3) updating
      pretty-printing and library support, and (4) adding tests.
      
      Test Plan: validate
      
      Reviewers: austin, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1088
      
      GHC Trac Issues: #10522
      21782739
  20. Jul 20, 2015
    • thomasw's avatar
      Support wild cards in TH splices · 49373ffe
      thomasw authored and Ben Gamari's avatar Ben Gamari committed
      - Declaration splices: partial type signatures are fully supported in TH
        declaration splices.
      
        For example, the wild cards in the example below will unify with `Eq
      a`
        and `a -> a -> Bool`, as expected:
      
      ```
      [d| foo :: _ => _
          foo x y = x == y |]
      ```
      
      - Expression splices: anonymous and named wild cards are supported in
        expression signatures, but extra-constraints wild cards aren't. Just
        as is the case for regular expression signatures.
      
      ```
      [e | Just True :: _a _ |]
      ```
      
      - Typed expression splices: the same wildcards as in (untyped)
        expression splices are supported.
      
      - Pattern splices: TH doesn't support type signatures in pattern
        splices, consequently, partial type signatures aren't supported
        either.
      
      - Type splices: partial type signatures are only partially supported in
        type splices, specifically: only anonymous wild cards are allowed.
      
        So `[t| _ |]`, `[t| _ -> Maybe _ |]` will work, but `[t| _ => _ |]` or
        `[| _a |]` won't (without `-XNamedWildCards`, the latter will work as
        the named wild card is treated as a type variable).
      
        Normally, named wild cards are collected before renaming a (partial)
        type signature. However, TH type splices are run during renaming, i.e.
        after the initial traversal, leading to out of scope errors for named
        wild cards. We can't just extend the initial traversal to collect the
        named wild cards in TH type splices, as we'd need to expand them,
        which is supposed to happen only once, during renaming.
      
        Similarly, the extra-constraints wild card is handled right before
        renaming too, and is therefore also not supported in a TH type splice.
        Another reason not to support extra-constraints wild cards in TH type
        splices is that a single signature can contain many TH type splices,
        whereas it mustn't contain more than one extra-constraints wild card.
        Enforcing would this be hard the way things are currently organised.
      
        Anonymous wild cards pose no problem, because they start without names
        and are given names during renaming. These names are collected right
        after renaming. The names generated for anonymous wild cards in TH
        type splices will thus be collected as well.
      
        With a more invasive refactoring of the renaming, partial type
        signatures could be fully supported in TH type splices. As only
        anonymous wild cards have been requested so far, these small changes
        satisfying this request will do for now. Also don't forget that a TH
        declaration splices support all kinds of wild cards.
      
      - Extra-constraints wild cards were silently ignored in expression and
        pattern signatures, appropriate error messages are now generated.
      
      Test Plan: run new tests
      
      Reviewers: austin, goldfire, adamgundry, bgamari
      
      Reviewed By: goldfire, adamgundry, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1048
      
      GHC Trac Issues: #10094, #10548
      49373ffe
  21. Jul 16, 2015
    • Ryan Scott's avatar
      Handle Char#, Addr# in TH quasiquoter (fixes #10620) · 2c9de9c9
      Ryan Scott 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
  22. Dec 10, 2014
  23. Nov 20, 2014
  24. Nov 12, 2014
  25. Nov 02, 2014
  26. Oct 07, 2014
    • glguy's avatar
      Add support for LINE pragma in template-haskell · adcb9dbc
      glguy authored
      Summary:
      Provide a way to generate {-# LINE #-} pragmas when generating
      Decs in Template Haskell. This allows more meaningful line
      numbers to be reported in compile-time errors for dynamically
      generated code.
      
      Test Plan: Run test suite
      
      Reviewers: austin, hvr
      
      Reviewed By: austin
      
      Subscribers: hvr, simonmar, ezyang, carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D299
      adcb9dbc
  27. Jun 11, 2014
  28. May 19, 2014
  29. Feb 09, 2014
  30. Jan 09, 2014
  31. Dec 28, 2013
  32. Nov 02, 2013
  33. Oct 04, 2013
Loading