diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-02-23 20:09:42 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-04 12:44:26 -0500 |
commit | de56cc7ecf93c7439a6acf76892c08124fe3c64b (patch) | |
tree | cbb6e450be6ac06b29746351db917b2b29aa7518 /docs | |
parent | c534b3dd30de8d5a59ff64628a6a0b3eb938a102 (diff) | |
download | haskell-de56cc7ecf93c7439a6acf76892c08124fe3c64b.tar.gz |
Update documentation of LiberalTypeSynonyms
We no longer require LiberalTypeSynonyms to use 'forall' or an unboxed
tuple in a synonym.
I also removed that kind checking before expanding synonyms "could be changed".
This was true when type synonyms were thought of macros, but with
the extensions such as SAKS or matchability I don't see it changing.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/exts/liberal_type_synonyms.rst | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/docs/users_guide/exts/liberal_type_synonyms.rst b/docs/users_guide/exts/liberal_type_synonyms.rst index 6d8229bae9..b0e295ab2f 100644 --- a/docs/users_guide/exts/liberal_type_synonyms.rst +++ b/docs/users_guide/exts/liberal_type_synonyms.rst @@ -17,25 +17,6 @@ many rules on individual synonym declarations. With the *only after expanding type synonyms*. That means that GHC can be very much more liberal about type synonyms than Haskell 98. -- You can write a ``forall`` (including overloading) in a type synonym, - thus: :: - - type Discard a = forall b. Show b => a -> b -> (a, String) - - f :: Discard a - f x y = (x, show y) - - g :: Discard Int -> (Int,String) -- A rank-2 type - g f = f 3 True - -- If you also use :extension:`UnboxedTuples`, you can write an unboxed tuple - in a type synonym: :: - - type Pr = (# Int, Int #) - - h :: Int -> Pr - h x = (# x, x #) - - You can apply a type synonym to a forall type: :: type Foo a = a -> a -> Bool @@ -57,8 +38,7 @@ much more liberal about type synonyms than Haskell 98. foo :: forall x. x -> [x] -GHC currently does kind checking before expanding synonyms (though even -that could be changed). +GHC does kind checking before expanding synonyms. After expanding type synonyms, GHC does validity checking on types, looking for the following malformedness which isn't detected simply by |