summaryrefslogtreecommitdiff
path: root/libraries/template-haskell
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed a typo in template-haskell documentationBenjamin Hodgson2017-08-221-1/+1
| | | | | | The documentation for `Type`'s `ForallT` constructor had a typo (pun not intended). `ctxt` is separated from `type` in the surface syntax by a fat arrow (`=>`), not a thin arrow (`->`).
* Add MonadIO Q - by requiring MonadIO => QuasiOleg Grenrus2017-08-052-4/+11
| | | | | | | | | | | | Summary: This is follow-up to https://ghc.haskell.org/trac/ghc/ticket/10773 Reviewers: austin, goldfire, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3816
* Drop GHC 7.10 compatibilityRyan Scott2017-08-011-15/+1
| | | | | | | | | | | | | | | | GHC 8.2.1 is out, so now GHC's support window only extends back to GHC 8.0. This means we can delete gobs of code that was only used for GHC 7.10 support. Hooray! Test Plan: ./validate Reviewers: hvr, bgamari, austin, goldfire, simonmar Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3781
* Follow-up to #13887, for promoted infix constructorsRyan Scott2017-07-291-2/+2
| | | | | | | | | | | | | | | | Summary: Correct a couple more spots in the TH pretty-printer by applying the appropriate parenthesization for infix names. Fixes #13887 (again). Test Plan: make test TEST=T13887 Reviewers: austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13887 Differential Revision: https://phabricator.haskell.org/D3802
* Merge types and kinds in DsMetaRyan Scott2017-07-284-788/+994
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Types and kinds are now the same in GHC... well, except in the code that involves Template Haskell, where types and kinds are given separate treatment. This aims to unify that treatment in the `DsMeta` module. The gist of this patch is replacing all uses of `repLKind` with `repLTy`. This is isn't quite as simple as one might imagine, since `repLTy` returns a `Core (Q Type)` (a monadic expression), whereas `repLKind` returns a `Core Kind` (a pure expression). This causes many awkward impedance mismatches. One option would be to change every combinator in `Language.Haskell.TH.Lib` to take `KindQ` as an argument instead of `Kind`. But this would be a breaking change of colossal proportions. Instead, this patch takes a somewhat different approach. This migrates the existing `Language.Haskell.TH.Lib` module to `Language.Haskell.TH.Lib.Internal`, and changes all `Kind`-related combinators in `Language.Haskell.TH.Lib.Internal` to live in `Q`. The new `Language.Haskell.TH.Lib` module then re-exports most of `Language.Haskell.TH.Lib.Internal` with the exception of the `Kind`-related combinators, for which it redefines them to be their current definitions (which don't live in `Q`). This allows us to retain backwards compatibility with previous `template-haskell` releases, but more importantly, it allows GHC to make as many changes to the `Internal` code as it wants for its purposes without fear of disrupting the public API. This solves half of #11785 (the other half being `TcSplice`). Test Plan: ./validate Reviewers: goldfire, austin, bgamari Reviewed By: goldfire Subscribers: rwbarton, thomie GHC Trac Issues: #11785 Differential Revision: https://phabricator.haskell.org/D3751
* Add Template Haskell support for overloaded labelsMatthew Pickering2017-07-111-0/+6
| | | | | | | | | | Reviewers: RyanGlScott, austin, goldfire, bgamari Reviewed By: RyanGlScott, goldfire, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3715
* Parenthesize infix type names in data declarations in TH printerEugene Akentyev2017-07-111-3/+4
| | | | | | | | | | | | Previously datatype names were not paraenthesized (#13887). Reviewers: austin, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3717
* Add Template Haskell support for overloaded labelsMatthew Pickering2017-07-114-1/+8
| | | | | | | | | | Reviewers: RyanGlScott, austin, goldfire, bgamari Reviewed By: RyanGlScott, goldfire, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3715
* Fix pretty-printing of zero-argument lambda expressionsRyan Scott2017-06-231-0/+1
| | | | | | | | | | | | | | | | | | Using Template Haskell, one can construct lambda expressions with no arguments. The pretty-printer isn't aware of this fact, however. This changes that. Test Plan: make test TEST=T13856 Reviewers: bgamari, austin, goldfire Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13856 Differential Revision: https://phabricator.haskell.org/D3664
* Fix Haddock markupGabor Greif2017-06-141-1/+1
|
* template-haskell: Properly escape StrTyLit docEric Mertens2017-05-271-1/+1
|
* Fix Haddock markupAlexey Vagarenko2017-05-191-1/+1
|
* Typos in comments [ci skip]Gabor Greif2017-04-051-1/+1
|
* configure.ac: Bump version to 8.3ghc-8.3-startBen Gamari2017-03-092-2/+2
| | | | Bumps haddock submodule
* Comments only [ci skip]Gabor Greif2017-03-091-1/+1
|
* Allow compilation of C/C++/ObjC/ObjC++ files with module from THFrancesco Mazzoli2017-03-081-13/+16
| | | | | | | | | | | | | | | | | | | | The main goal is to easily allow the inline-c project (and similar projects such as inline-java) to emit C/C++ files to be compiled and linked with the current module. Moreover, `addCStub` is removed, since it's quite fragile. Most notably, the C stubs end up in the file generated by `CodeOutput.outputForeignStubs`, which is tuned towards generating a file for stubs coming from `capi` and Haskell-to-C exports. Reviewers: simonmar, austin, goldfire, facundominguez, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: snowleopard, rwbarton, dfeuer, thomie, duncan, mboes Differential Revision: https://phabricator.haskell.org/D3280
* Implement addCStub in template-haskell.Facundo Domínguez2017-02-091-0/+23
| | | | | | | | | | | | | | | | Summary: addCStub allows injecting C code in the current module to be included in the final object file. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Reviewed By: bgamari Subscribers: bitonic, duncan, mboes, thomie Differential Revision: https://phabricator.haskell.org/D3106
* Spelling fixesGabor Greif2017-02-022-2/+2
|
* Template Haskell support for COMPLETE pragmasMatthew Pickering2017-01-264-1/+11
| | | | | | | | | | Reviewers: RyanGlScott, austin, goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2997 GHC Trac Issues: #13098
* TH: Add Trustworthy language pragmaErik de Castro Lopo2017-01-081-1/+2
| | | | | | | | | | | | | | Test Plan: validate Reviewers: goldfire, bgamari, austin, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, simonpj, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D2546 GHC Trac Issues: #12511
* Introduce unboxedSum{Data,Type}Name to template-haskellRyan Scott2016-12-182-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: In D2448 (which introduced Template Haskell support for unboxed sums), I neglected to add `unboxedSumDataName` and `unboxedSumTypeName` functions, since there wasn't any way you could write unboxed sum data or type constructors in prefix form to begin with (see #12514). But even if you can't write these `Name`s directly in source code, it would still be nice to be able to use these `Name`s in Template Haskell (for instance, to be able to treat unboxed sum type constructors like any other type constructors). Along the way, this uncovered a minor bug in `isBuiltInOcc_maybe` in `TysWiredIn`, which was calculating the arity of unboxed sum data constructors incorrectly. Test Plan: make test TEST=T12478_5 Reviewers: osa1, goldfire, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2854 GHC Trac Issues: #12478, #12514
* Reexport Language.Haskell.TH.Lib from Language.Haskell.THRyan Scott2016-12-173-85/+115
| | | | | | | | | | | | | | | | | | | | Reexporting `Language.Haskell.TH.Lib` from `Language.Haskell.TH` ensures that `Language.Haskell.TH` will continue to expose all of the functions that `Language.Haskell.TH.Lib` does in the future. Fixes #12992. Test Plan: ./validate Reviewers: austin, bgamari, goldfire Reviewed By: bgamari, goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2867 GHC Trac Issues: #12992
* base: Bump version to 4.10.0.0Ben Gamari2016-12-151-1/+1
| | | | Updates a number of submodules.
* Make unboxedTuple{Type,Data}Name support 0- and 1-tuplesRyan Scott2016-12-152-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | Previously, these functions were hardcoded so as to always `error` whenever given an argument of 0 or 1. This restriction can be lifted pretty easily, however. This requires a slight tweak to `isBuiltInOcc_maybe` in `TysWiredIn` to allow it to recognize `Unit#` (which is the hard-wired `OccName` for unboxed 1-tuples). Fixes #12977. Test Plan: make test TEST=12977 Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2847 GHC Trac Issues: #12977
* Rename TH constructors for deriving strategiesRyan Scott2016-12-092-6/+6
| | | | | | | | | | | | | | | | | | | After talking to Richard, he and I concluded that choosing the rather common name `Newtype` to represent the corresponding deriving strategy in Template Haskell was a poor choice of name. I've opted to rename it to something less common (`NewtypeStrategy`) while we still have time. I also renamed the corrsponding datatype in the GHC internals so as to match it. Reviewers: austin, goldfire, hvr, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2814 GHC Trac Issues: #10598
* template-haskell: Version bumpBen Gamari2016-11-122-2/+3
|
* Implement deriving strategiesRyan Scott2016-09-305-33/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* TH: Use atomicModifyIORef' for fresh namesErik de Castro Lopo2016-09-281-3/+2
| | | | | | | | | | | | | | | This prevents the possibility of race conditions when creating fresh names. Test Plan: validate Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2548
* Comments in TH.Syntax (Trac #12596)Simon Peyton Jones2016-09-151-6/+31
| | | | See Note [Data for non-algebraic types]
* Fix TH ppr output for list comprehensions with only one StmtRyan Scott2016-09-111-6/+11
| | | | | | | | A folow-up to D2521 (which addressed #12583), where the `Outputable` `ppr` output was tweaked to display a list comprehension with only one `Stmt` as `[Foo]` instead of `[Foo|]` (which isn't valid Haskell). I forgot to update the corresponding code in `Language.Haskell.TH.Ppr` which pretty-prints `CompE`, however, so this commit takes care of that.
* Fix startsVarSym and refactor operator predicates (fixes #4239)Malo Jaffré2016-09-011-5/+3
| | | | | | | | | | | | | | | | | | | startsVarSym used isSymbol which does not recognize valid operators beginning with OtherPunctuation generalCategory (e. g. (·)). Move it to ghc-boot-th for reducing duplication. This patch fixes template-haskell pretty printer, which is used by -ddump-minimal-imports. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2480 GHC Trac Issues: #4239
* Revert "Fix startsVarSym and refactor operator predicates (fixes #4239)"Ben Gamari2016-09-011-3/+5
| | | | | This reverts commit 8d35e18d885e60f998a9dddb6db19762fe4c6d92. arc butchered the authorship on this.
* Fix startsVarSym and refactor operator predicates (fixes #4239)Ben Gamari2016-09-011-5/+3
| | | | | | | | | | | | | | | | | | | startsVarSym used isSymbol which does not recognize valid operators beginning with OtherPunctuation generalCategory (e. g. (·)). Move it to ghc-boot-th for reducing duplication. This patch fixes template-haskell pretty printer, which is used by -ddump-minimal-imports. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2480 GHC Trac Issues: #4239
* Clarify scope of `getQ`/`putQ` state.Francesco Mazzoli2016-08-311-2/+4
| | | | | | | | | | | | | The current haddocks do not specify the scope of the state manipulated by `getQ`/`putQ`. Reviewers: austin, goldfire, bgamari, ezyang Reviewed By: ezyang Subscribers: ezyang, thomie Differential Revision: https://phabricator.haskell.org/D2497
* Fix broken Haddock commentRyan Scott2016-08-291-1/+1
|
* Template Haskell support for TypeApplicationsRyan Scott2016-08-295-1/+9
| | | | | | | | | | | | | | | | Summary: Fixes #12530. Test Plan: make test TEST=12530 Reviewers: austin, bgamari, hvr, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2472 GHC Trac Issues: #12530
* Template Haskell support for unboxed sumsRyan Scott2016-08-235-34/+79
| | | | | | | | | | | | | | | | | | | | | | | 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
* Have addModFinalizer expose the local type environment.Facundo Domínguez2016-07-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: This annotates the splice point with 'HsSpliced ref e' where 'e' is the result of the splice. 'ref' is a reference that the typechecker will fill with the local type environment. The finalizer then reads the ref and uses the local type environment, which causes 'reify' to find local variables when run in the finalizer. Test Plan: ./validate Reviewers: simonpj, simonmar, bgamari, austin, goldfire Reviewed By: goldfire Subscribers: simonmar, thomie, mboes Differential Revision: https://phabricator.haskell.org/D2286 GHC Trac Issues: #11832
* Add template-haskell changelog note for #8761Ryan Scott2016-06-241-0/+8
|
* Clean up outdated comments in template-haskell changelogRyan Scott2016-06-241-6/+3
| | | | | | | * Replaced 2.11's *TBA* with *May 2016* * Removed an outdated TODO comment * Removed lines which incorrectly stated that some strictness-related functions had been removed (they have been deprecated instead)
* Remove 'deriving Typeable' statementsRyan Scott2016-05-241-50/+50
| | | | | | | | | | | | | | | | | Summary: Deriving `Typeable` has been a no-op since GHC 7.10, and now that we require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable` statements in GHC. Test Plan: ./validate Reviewers: goldfire, austin, hvr, bgamari Reviewed By: austin, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2260
* Move Extension type to ghc-boot-thBen Gamari2016-05-162-4/+4
| | | | | | | | | | | | | | | | | | | | This creates a new package, `ghc-boot-th`, to contain the `Extension` type, which now lives in `GHC.LanguageExtension.Type`. This ensures that the transitive dependency set of the `template-haskell` package remains minimal. The `GHC.LanguageExtensions.Type` module is also re-exported by `ghc-boot`, which provides an orphan `binary` instance as well. Test Plan: Validate Reviewers: goldfire, thomie, hvr, austin Reviewed By: thomie Subscribers: RyanGlScott, thomie, erikd, ezyang Differential Revision: https://phabricator.haskell.org/D2224
* Add TH support for pattern synonyms (fixes #8761)Dominik Bollmann2016-05-125-26/+184
| | | | | | | | | | | | | | | | | | This commit adds Template Haskell support for pattern synonyms as requested by trac ticket #8761. Test Plan: ./validate Reviewers: thomie, jstolarek, osa1, RyanGlScott, mpickering, austin, goldfire, bgamari Reviewed By: goldfire, bgamari Subscribers: rdragon Differential Revision: https://phabricator.haskell.org/D1940 GHC Trac Issues: #8761
* TH: Tweak Haddock languageBen Gamari2016-04-171-2/+2
|
* Add TemplateHaskell support for Overlapping pragmasIavor S. Diatchki2016-04-175-6/+35
| | | | | | | | | | Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2118
* template-haskell: define `MonadFail Q` instanceHerbert Valerio Riedel2016-03-082-0/+21
| | | | | | | | | | | | | | | | When `MonadFail`is available, this patch makes `MonadFail` a superclass of `Quasi`, and `Q` an instance of `MonadFail`. NB: Since f16ddcee0c64a92ab911a7841a8cf64e3ac671fd, we need to be able to compile `template-haskell` with stage0 compilers that don't provide a `MonadFail` class yet. Once we reach GHC 8.3 development we can drop the CPP conditionals again. Addresses #11661 Reviewed By: bgamari, goldfire Differential Revision: https://phabricator.haskell.org/D1982
* template-haskell: remove redundant CPP useHerbert Valerio Riedel2016-03-081-9/+0
| | | | | GHC 8.1's template-haskell package requires base>=4.8 anyway, so we can assume Numeric.Natural to be available unconditionally.
* template-haskell: Drop use of Rank2Types/PolymorphicComponentsHerbert Valerio Riedel2016-03-082-7/+8
| | | | | | | | As per #6032, `Rank2Types` and `PolymorphicComponents` have been deprecated in favour of `RankNTypes`. also update `other-extensions` in template-haskell.cabal flag to reflect reality.
* Switch from -this-package-key to -this-unit-id.Edward Z. Yang2016-01-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small cosmetic change, but we have to do a bit of work to actually support it: - Cabal submodule update, so that Cabal passes us -this-unit-id when we ask for it. This includes a Cabal renaming to be consistent with Unit ID, which makes ghc-pkg a bit more scrutable. - Build system is updated to use -this-unit-id rather than -this-package-key, to avoid deprecation warnings. Needs a version test so I resurrected the old test we had (sorry rwbarton!) - I've *undeprecated* -package-name, so that we are in the same state as GHC 7.10, since the "correct" flag will have only entered circulation in GHC 8.0. - I removed -package-key. Since we didn't deprecate -package-id I think this should not cause any problems for users; they can just change their code to use -package-id. - The package database is indexed by UNIT IDs, not component IDs. I updated the naming here. - I dropped the signatures field from ExposedModule; nothing was using it, and instantiatedWith from the package database field. - ghc-pkg was updated to use unit ID nomenclature, I removed the -package-key flags but I decided not to add any new flags for now. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: 23Skidoo, thomie, erikd Differential Revision: https://phabricator.haskell.org/D1780
* TemplateHaskell: revive isStrict, notStrict and unpackedThomas Miedema2016-01-132-0/+15
| | | | | | | | | | | | | These 3 functions are useful to keep around a bit longer, to prevent breaking existing code that uses them. Related to #10697. Reviewers: austin, goldfire, RyanGlScott, bgamari Reviewed By: RyanGlScott, bgamari Differential Revision: https://phabricator.haskell.org/D1761