Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
bc35c8ed
Commit
bc35c8ed
authored
Oct 28, 2008
by
simonpj@microsoft.com
Browse files
Clarify documentatoin
parent
a5984078
Changes
1
Hide whitespace changes
Inline
Side-by-side
docs/users_guide/glasgow_exts.xml
View file @
bc35c8ed
...
...
@@ -5322,9 +5322,13 @@ f xs = ys ++ ys
ys :: [a]
ys = reverse xs
</programlisting>
The type signature for
<literal>
f
</literal>
brings the type variable
<literal>
a
</literal>
into scope; it scopes over
the entire definition of
<literal>
f
</literal>
.
In particular, it is in scope at the type signature for
<varname>
ys
</varname>
.
The type signature for
<literal>
f
</literal>
brings the type variable
<literal>
a
</literal>
into scope,
because of the explicit
<literal>
forall
</literal>
(
<xref
linkend=
"decl-type-sigs"
/>
).
The type variables bound by a
<literal>
forall
</literal>
scope over
the entire definition of the accompanying value declaration.
In this example, the type variable
<literal>
a
</literal>
scopes over the whole
definition of
<literal>
f
</literal>
, including over
the type signature for
<varname>
ys
</varname>
.
In Haskell 98 it is not possible to declare
a type for
<varname>
ys
</varname>
; a major benefit of scoped type variables is that
it becomes possible to do so.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment