diff options
-rw-r--r-- | docs/users_guide/exts/partial_type_signatures.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/users_guide/exts/partial_type_signatures.rst b/docs/users_guide/exts/partial_type_signatures.rst index 4d523dd80f..a6a4f73a6a 100644 --- a/docs/users_guide/exts/partial_type_signatures.rst +++ b/docs/users_guide/exts/partial_type_signatures.rst @@ -151,6 +151,20 @@ Besides an extra-constraints wildcard (see :ref:`extra-constraints-wildcard`), only named wildcards can occur in the constraints, e.g. the ``_x`` in ``Show _x``. +When :extension:`ScopedTypeVariables` is on, the named wildcards of a +function signature scope over the function body just like +explicitly-forall'd type variables (:ref:`scoped-type-variables`), +even though there is no explicit forall. For example: :: + + f :: _a -> _a + f x = let g :: _a -> _a + g = ... + in ... + +Here the named wildcard ``_a`` scopes over the body of ``f``, thereby +binding the occurrences of ``_a`` in the signature of ``g``. All +four occurrences stand for the same type. + Named wildcards *should not be confused with type variables*. Even though syntactically similar, named wildcards can unify with monotypes as well as be generalised over (and behave as type variables). |