... | ... | @@ -154,24 +154,45 @@ GHC can now detect more uses of literal values that do not lie within the expect |
|
|
- Negative `Natural` literals (from `Numeric.Natural`), such as `(-123) :: Natural`.
|
|
|
- Empty `Natural` enumerations, such as `[10..3] :: [Natural]`.
|
|
|
|
|
|
### Stricter checks on uses of unsaturated type synonyms
|
|
|
### Stricter type synonym validity-checking
|
|
|
|
|
|
|
|
|
Previously, GHC would accept some uses of type synonyms which did not have all of their arguments supplied without requiring the `LiberalTypeSynonyms` extension. Starting with version 8.8, GHC is stricter about requiring the extension in these cases.
|
|
|
Previous versions of GHC would permit code that should require certain language extensions to be enabled even when those extensions weren't actually on. Here are two notable examples:
|
|
|
|
|
|
1. Previously, GHC would accept some uses of type synonyms which did not have all of their arguments supplied without requiring the `LiberalTypeSynonyms` extension. Starting with version 8.8, GHC is stricter about requiring the extension in these cases.
|
|
|
|
|
|
For example, this code requires `LiberalTypeSynonyms` in GHC 8.8:
|
|
|
>
|
|
|
> For example, this code requires `LiberalTypeSynonyms` in GHC 8.8:
|
|
|
|
|
|
```wiki
|
|
|
type Generic i o = forall x. i x -> o x
|
|
|
type Id x = x
|
|
|
```
|
|
|
typeGeneric i o = forall x. i x -> o x
|
|
|
typeId x = x
|
|
|
|
|
|
foo :: Generic Id Id
|
|
|
foo = undefined
|
|
|
foo::GenericIdIdfoo= undefined
|
|
|
```
|
|
|
|
|
|
>
|
|
|
> If GHC is complaining about type synonyms not being passed enough arguments or an 'illegal polymorphic type', try enabling `LiberalTypeSynonyms` in that module.
|
|
|
|
|
|
1. Previously, it was possible to sneak in impredicative types through clever use of type synonyms. For instance, this code used to compile even without the `ImpredicativeTypes` extension enabled!
|
|
|
|
|
|
```
|
|
|
{-# LANGUAGE RankNTypes #-}typeFoo x = forall a. a -> a
|
|
|
typeBar x =Int->Foo x
|
|
|
|
|
|
If GHC is complaining about type synonyms not being passed enough arguments or an 'illegal polymorphic type', try enabling `LiberalTypeSynonyms` in that module.
|
|
|
f::[Bar()]-- Impredicative!f=[]
|
|
|
```
|
|
|
|
|
|
>
|
|
|
> GHC will now properly reject this:
|
|
|
|
|
|
```wiki
|
|
|
• Illegal polymorphic type: forall a. a -> a
|
|
|
GHC doesn't yet support impredicative polymorphism
|
|
|
• In the expansion of type synonym ‘Foo’
|
|
|
In the expansion of type synonym ‘Bar’
|
|
|
In the type signature: f :: [Bar ()]
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
... | ... | |