... | ... | @@ -367,6 +367,23 @@ GHC 9.0 implements [Proposal 246](https://github.com/ghc-proposals/ghc-proposals |
|
|
|
|
|
Another solution is to use the `DeriveLift` extension rather than manually defining the instance.
|
|
|
|
|
|
You may consider using the [`th-compat`](http://hackage.haskell.org/package/th-compat) library if you wish to write backwards-compatible code that uses the `Quote` type class.
|
|
|
|
|
|
### Typed TH quotes and splices have different types
|
|
|
|
|
|
GHC 9.0 implements [Proposal 195](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0195-code-texp.rst), which means that typed Template Haskell now uses a `Code` newtype:
|
|
|
|
|
|
```hs
|
|
|
newtype Code m a = Code { examineCode :: m (TExp a) }
|
|
|
```
|
|
|
|
|
|
In particular, `Code` is now used in the following places:
|
|
|
|
|
|
* In a typed TH quote, such as `[|| ... ||]`, if the `...` expression has type `a`, then the quotation has type `Quote m => Code m a`. (Previously, it would have had type `Q (TExp a)`.)
|
|
|
* In a typed TH splice, such as `$$(...)`, the `...` expression must have type `Code Q a` for some `a`. (Previously, it must have had type `Q (TExp a)`.)
|
|
|
|
|
|
You may consider using the [`th-compat`](http://hackage.haskell.org/package/th-compat) library if you wish to write backwards-compatible typed TH code involving `Code`.
|
|
|
|
|
|
### Type variable order in top-level field selectors
|
|
|
|
|
|
Previous versions of GHC did not specify the order or specificity of type variables in the types of top-level field selectors. GHC 9.0 does specify this, which can impact users of `TypeApplications`. For example, given the following definitions:
|
... | ... | |