From de56cc7ecf93c7439a6acf76892c08124fe3c64b Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski Date: Wed, 23 Feb 2022 20:09:42 +0100 Subject: 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. --- docs/users_guide/exts/liberal_type_synonyms.rst | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'docs') 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 -- cgit v1.2.1