summaryrefslogtreecommitdiff
path: root/libraries/template-haskell
Commit message (Collapse)AuthorAgeFilesLines
* fix #10734 by adding braces to pretty-printing of let inside doarcpatch-D1448John Leo2015-11-071-1/+1
| | | | | | | | | | | | | | Test Plan: validate Reviewers: bgamari, austin, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1448 GHC Trac Issues: #10734
* Bump `base` version to 4.9.0.0 (closes #11026)Herbert Valerio Riedel2015-11-011-1/+1
| | | | | | | | | | | This also relaxes a few upper bounds on base in the ghc.git repo; This required a mass-rewrite in testsuite/ sed -i s,base-4.8.2.0,base-4.9.0.0,g $(git grep -Fl 'base-4.8.2.0') because it turns out the testsuite is still sensitive to package version changes.
* template-haskell: set explicit return=pureHerbert Valerio Riedel2015-10-182-0/+2
| | | | This fixups a thinko in c6781a5064049e0a7c17c1f2239567a3c44955af
* template-haskell: MRP-refactor Applicative/Monad instancesHerbert Valerio Riedel2015-10-182-4/+3
| | | | | As `template-haskell` is compiled by stage1+ GHC only, we can drop the explicit `return` definition rightaway.
* Add typed holes support in Template Haskell.Jan Stolarek2015-10-163-0/+8
| | | | | Fixes #10267. Typed holes in typed Template Haskell currently don't work. See #10945 and #10946.
* Rename package key to unit ID, and installed package ID to component ID.Edward Z. Yang2015-10-141-1/+1
| | | | | | Comes with Haddock submodule update. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Make dataToQa aware of Data instances which use functions to implement toConstrRyanGlScott2015-10-134-13/+66
| | | | | | | | | | | | | | | | | | | | 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
* DeriveLift extension (#1830)RyanGlScott2015-09-211-0/+23
| | | | | | | | | | | | | | | | | | | | Summary: This implements -XDeriveLift, which allows for automatic derivation of the Lift class from template-haskell. The implementation is based off of Ian Lynagh's th-lift library (http://hackage.haskell.org/package/th-lift). Test Plan: ./validate Reviewers: hvr, simonpj, bgamari, goldfire, austin Reviewed By: goldfire, austin Subscribers: osa1, thomie Differential Revision: https://phabricator.haskell.org/D1168 GHC Trac Issues: #1830
* Add namePackage function to template-haskellRyanGlScott2015-09-173-2/+37
| | | | | | | | | | | | | | 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
* Injective type familiesJan Stolarek2015-09-035-53/+142
| | | | | | | | | | | | | | | | | | | For details see #6018, Phab:D202 and the wiki page: https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies This patch also wires-in Maybe data type and updates haddock submodule. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Subscribers: mpickering, bgamari, alanz, thomie, goldfire, simonmar, carter Differential Revision: https://phabricator.haskell.org/D202 GHC Trac Issues: #6018
* template-haskell: Add changelog entry to infix type operatorsBen Gamari2015-08-121-0/+6
|
* Bump template-haskell to new major version 2.11Herbert Valerio Riedel2015-08-122-1/+8
| | | | | | | ...since we already have introduced backward compat breakage that breaks packages such as QuickCheck-2.8.1 Differential Revision: https://phabricator.haskell.org/D1144
* Add Fixity info for infix typesRyanGlScott2015-08-053-11/+17
| | | | | | | | | | | | | | | | | | | | | | 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
* Typos in comments [skip ci]Gabor Greif2015-08-031-1/+1
|
* Add UInfixT to TH types (fixes #10522)Michael Smith2015-07-274-10/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Delete __GLASGOW_HASKELL__ ifdefs for stage0 < 7.8Thomas Miedema2015-07-211-6/+0
| | | | | | | | | | Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D904
* Support wild cards in TH splicesThomas Winant2015-07-203-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Handle Char#, Addr# in TH quasiquoter (fixes #10620)RyanGlScott2015-07-174-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move liftData and use it as a default definition for Lift.Edward Z. Yang2015-06-032-76/+101
| | | | | | | | | | | | | | | | | | | | | Summary: This should make it a lot easier to define Lift instances. See https://mail.haskell.org/pipermail/libraries/2015-May/025728.html for motivating discussion. I needed to muck out some code from Quote into Syntax to get the definition in the right place; but I would argue that code never really belonged in Quote to begin with. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, ekmett, goldfire Subscribers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D923
* Add liftData function.Edward Z. Yang2015-05-281-2/+8
| | | | | | | | | | | | | | | | Summary: See https://mail.haskell.org/pipermail/libraries/2015-April/025480.html for the proposal and discussion Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin Subscribers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D879
* Make template-haskell build with GHC 7.6, fixes bootstrap build.Edward Z. Yang2015-05-112-3/+11
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate on 7.6 Reviewers: austin, goldfire Subscribers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D885
* Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382.Edward Z. Yang2015-05-113-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Edward 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
* Revert stage 1 template-haskell. This is a combination of 5 commits.Edward Z. Yang2015-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | Revert "Quick fix: drop base bound on template-haskell." This reverts commit 3c70ae032e4361b203dfcf22b0a424e8838a5037. Revert "Always do polymorphic typed quote check, c.f. #10384" This reverts commit 9a43b2c1f78b3cf684646af64b9b67dc8079f58f. Revert "RnSplice's staging test should be applied for quotes in stage1." This reverts commit eb0ed4030374af542c0a459480d32c8d4525e48d. Revert "Split off quotes/ from th/ for tests that can be done on stage1 compiler." This reverts commit 21c72e7d38c96ac80d31addf67ae4b3c7a6c3bbb. Revert "Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382." This reverts commit 28257cae77023f2ccc4cc1c0cd1fbbd329947a00.
* Quick fix: drop base bound on template-haskell.Edward Z. Yang2015-05-091-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Documentation for Language.Haskell.TH.Quote.Edward Z. Yang2015-05-041-7/+41
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D850
* Try to reconstruct a changelog for TH 2.10Herbert Valerio Riedel2015-03-201-1/+18
| | | | | | [skip ci] (cherry picked from commit 9d15af88b9b5cbf9dd4a4d072aa94540074cc4b3)
* Put parens around (ty :: kind) when pretty-printing TH syntaxSimon Peyton Jones2015-02-061-2/+13
| | | | | See Note [Pretty-printing kind signatures] in Language.Haskell.TH.Ppr.hs, and Trac #10050.
* Add instance Lift NaturalRichard Eisenberg2014-12-191-0/+5
|
* Merge some instances from th-orphans.Richard Eisenberg2014-12-192-6/+54
|
* Add Ord instances to THRichard Eisenberg2014-12-101-34/+34
|
* Implement -XStaticValuesFacundo Domínguez2014-12-094-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As proposed in [1], this extension introduces a new syntactic form `static e`, where `e :: a` can be any closed expression. The static form produces a value of type `StaticPtr a`, which works as a reference that programs can "dereference" to get the value of `e` back. References are like `Ptr`s, except that they are stable across invocations of a program. The relevant wiki pages are [2, 3], which describe the motivation/ideas and implementation plan respectively. [1] Jeff Epstein, Andrew P. Black, and Simon Peyton-Jones. Towards Haskell in the cloud. SIGPLAN Not., 46(12):118–129, September 2011. ISSN 0362-1340. [2] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers [3] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers/ImplementationPlan Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io> Authored-by: Mathieu Boespflug <m@tweag.io> Authored-by: Alexander Vershilov <alexander.vershilov@tweag.io> Test Plan: `./validate` Reviewers: hvr, simonmar, simonpj, austin Reviewed By: simonpj, austin Subscribers: qnikst, bgamari, mboes, carter, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D550 GHC Trac Issues: #7015
* Make calling conventions in template haskell Syntax.hs consistent with those ↵Luite Stegeman2014-11-193-5/+10
| | | | | | | | | | | | | | | | | | in ghc ForeignCall.hs this impliments #9703 from ghc trac Test Plan: still needs tests Reviewers: cmsaperstein, ekmett, goldfire, austin Reviewed By: goldfire, austin Subscribers: goldfire, thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D353 GHC Trac Issues: #9703
* add missing instances for Loc and a few missing Eq instancesLuite Stegeman2014-11-191-2/+3
| | | | | | | | | | | | Summary: This adds a few missing instances that can be automatically derived Reviewers: hvr, goldfire, austin Reviewed By: goldfire, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D495
* template-haskell: Missing instances for Rational and ().Mathieu Boespflug2014-11-191-2/+9
| | | | | | | | | | | | Test Plan: ./validate Reviewers: austin Reviewed By: austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D492
* document addDependentFile uses contents, not mtimeGreg Weber2014-11-171-2/+9
| | | | | | | | | | | | Reviewers: austin Reviewed By: austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D481 GHC Trac Issues: #4900
* Fix #9064 by adding support for generic default signatures to TH.Richard Eisenberg2014-11-124-1/+11
|
* Fix #8100, by adding StandaloneDerivD to TH's Dec type.Richard Eisenberg2014-11-124-1/+12
|
* Derive Generic for TH types (#9527)Richard Eisenberg2014-11-121-41/+42
|
* Remove unboxed Int# fields from NameFlavour (#9527)Richard Eisenberg2014-11-122-98/+19
|
* Untabify template-haskell.Richard Eisenberg2014-11-125-51/+51
|
* Fix #9738, by handling {-# ANN ... #-} in DsMeta.Richard Eisenberg2014-11-011-0/+11
|
* Add support for LINE pragma in template-haskellEric Mertens2014-10-074-0/+7
| | | | | | | | | | | | | | | | | | 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
* `M-x delete-trailing-whitespace` & `M-x untabify`Herbert Valerio Riedel2014-09-241-72/+72
|
* Move `Maybe`-typedef into GHC.BaseHerbert Valerio Riedel2014-09-161-2/+2
| | | | | | | This is preparatory work for reintroducing SPECIALISEs that were lost in d94de87252d0fe2ae97341d186b03a2fbe136b04 Differential Revision: https://phabricator.haskell.org/D214
* Bump `base` version to 4.8.0.0 for realHerbert Valerio Riedel2014-09-092-2/+9
| | | | | | | | | | | | | | | | This commit updates several submodules in order to bump the upper bounds on `base` of most boot packages Moreover, this updates some of the test-suite cases which have version numbers hardcoded within. However, I'm not sure if this commit didn't introduce the following two test-failures ghc-api T8628 [bad stdout] (normal) ghc-api T8639_api [bad stdout] (normal) This needs investigation
* Make Applicative a superclass of MonadAustin Seipp2014-09-092-2/+3
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* Package keys (for linking/type equality) separated from package IDs.Edward Z. Yang2014-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch set makes us no longer assume that a package key is a human readable string, leaving Cabal free to "do whatever it wants" to allocate keys; we'll look up the PackageId in the database to display to the user. This also means we have a new level of qualifier decisions to make at the package level, and rewriting some Safe Haskell error reporting code to DTRT. Additionally, we adjust the build system to use a new ghc-cabal output Make variable PACKAGE_KEY to determine library names and other things, rather than concatenating PACKAGE/VERSION as before. Adds a new `-this-package-key` flag to subsume the old, erroneously named `-package-name` flag, and `-package-key` to select packages by package key. RFC: The md5 hashes are pretty tough on the eye, as far as the file system is concerned :( ToDo: safePkg01 test had its output updated, but the fix is not really right: the rest of the dependencies are truncated due to the fact the we're only grepping a single line, but ghc-pkg is wrapping its output. ToDo: In a later commit, update all submodules to stop using -package-name and use -this-package-key. For now, we don't do it to avoid submodule explosion. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D80
* Simplify .gitignore filesHerbert Valerio Riedel2014-06-281-2/+16
| | | | | | | | | It's a bit confusing to have .gitignore files spread all over the filesystem. This commit tries to consolidate those into one .gitignore file per component. Moreover, we try to describe files to be ignored which happen to have a common identifying pattern by glob patterns. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Whitespace onlyGabor Greif2014-06-281-61/+61
|
* Typos in commentsGabor Greif2014-06-191-1/+1
|