diff options
author | Haskell-mouse <rinat.stryungis@serokell.io> | 2019-02-28 20:26:16 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-25 14:02:22 -0400 |
commit | d763b2e7097a2dc14f4917d7e9f0cbd5c7085961 (patch) | |
tree | 1bd17760a1d9a449978723d64f22d6801adf6ceb /docs/users_guide | |
parent | cd85f8a71bb56cff332560e1d571b3406789fb71 (diff) | |
download | haskell-d763b2e7097a2dc14f4917d7e9f0cbd5c7085961.tar.gz |
User's Guide: extensions compatibility
Adds the mention that extensions "AllowAmbiguousTypes" and "RankNTypes"
are not always compatible with each other.
Specifies the conditions and causes of failing in resolving
of ambiguity.
Diffstat (limited to 'docs/users_guide')
-rw-r--r-- | docs/users_guide/glasgow_exts.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 5a86e877c4..ccb3afb7ed 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10358,6 +10358,24 @@ function that can *never* be called, such as this one: :: f :: (Int ~ Bool) => a -> a +Sometimes :extension:`AllowAmbiguousTypes` does not mix well with :extension:`RankNTypes`. +For example: :: + foo :: forall r. (forall i. (KnownNat i) => r) -> r + foo f = f @1 + + boo :: forall j. (KnownNat j) => Int + boo = .... + + h :: Int + h = foo boo + +This program will be rejected as ambiguous because GHC will not unify +the type variables `j` and `i`. + +Unlike the previous examples, it is not currently possible +to resolve the ambiguity manually by using :extension:`TypeApplications`. + + .. note:: *A historical note.* GHC used to impose some more restrictive and less principled conditions on type signatures. For type |