diff options
author | Austin Seipp <austin@well-typed.com> | 2014-01-14 20:16:26 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-01-14 20:16:26 -0600 |
commit | 235fd88a9a35a6ca1aed70ff71291d7b433e45e4 (patch) | |
tree | 6a061872030e2b662db0de656807b387730051fa /docs | |
parent | 3e633d9b77a50e6f34bdcc556d47b4a09faa1d2d (diff) | |
download | haskell-235fd88a9a35a6ca1aed70ff71291d7b433e45e4.tar.gz |
Turn -XTypeHoles into a (on by default) warning
After some discussion on ghc-devs@ and elsewhere, it seemed favorable to
make this change as type holes don't let any invalid programs though,
they merely change what the compiler reports in case of certain errors
(namely unbound occurrences, or _ appearing on a LHS.)
Now, the warning mechanism is controlled by -f[no-]warn-type-errors,
just like any other regular warning. Again, on by default.
The documentation and tests have been updated accordingly.
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/7.8.1-notes.xml | 15 | ||||
-rw-r--r-- | docs/users_guide/flags.xml | 13 | ||||
-rw-r--r-- | docs/users_guide/glasgow_exts.xml | 11 | ||||
-rw-r--r-- | docs/users_guide/using.xml | 20 |
4 files changed, 41 insertions, 18 deletions
diff --git a/docs/users_guide/7.8.1-notes.xml b/docs/users_guide/7.8.1-notes.xml index 46624ffe6f..a5edeea943 100644 --- a/docs/users_guide/7.8.1-notes.xml +++ b/docs/users_guide/7.8.1-notes.xml @@ -18,13 +18,14 @@ <itemizedlist> <listitem> <para> - GHC now supports "type holes" with the - <literal>TypeHoles</literal> extension. When enabled, the - unbound literal <literal>_</literal> may be used during - development in place of a regular identifier, and GHC will - respond with the type necessary to "fill in the hole." - - TODO FIXME: reference. + By default, GHC has a new warning enabled, + <literal>-fwarn-type-holes</literal>, which causes the + compiler to respond with the types of unbound + variables it encounters in the source code. (It is + reminiscient of the "holes" feature in languages such + as Agda.) + + For more information, see <xref linkend="type-holes"/>. </para> </listitem> diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 2422b9d36d..a9b989d6ae 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -1225,12 +1225,6 @@ <entry><option>-</option></entry> </row> <row> - <entry><option>-XTypeHoles</option></entry> - <entry>Enable <link linkend="type-holes">holes</link> in expressions.</entry> - <entry>dynamic</entry> - <entry><option>--XNoTypeHoles</option></entry> - </row> - <row> <entry><option>-fpackage-trust</option></entry> <entry>Enable <link linkend="safe-haskell">Safe Haskell</link> trusted package requirement for trustworthy modules.</entry> <entry>dynamic</entry> @@ -1527,6 +1521,13 @@ <entry><option>-fno-warn-amp</option></entry> </row> + <row> + <entry><option>-fwarn-type-holes</option></entry> + <entry>Enable <link linkend="type-holes">holes</link> in expressions.</entry> + <entry>dynamic</entry> + <entry><option>-fno-warn-type-holes</option></entry> + </row> + </tbody> </tgroup> </informaltable> diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 70a38768f9..32f2c2e1b4 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -7668,11 +7668,14 @@ with <option>-XNoMonoLocalBinds</option> but type inference becomes less predica </sect3> </sect2> -<sect2 id="type-holes"> +</sect1> +<!-- ==================== End of type system extensions ================= --> + +<sect1 id="type-holes"> <title>Type Holes</title> <para>Type hole support is enabled with the option -<option>-XTypeHoles</option>.</para> +<option>-fwarn-type-holes</option>, which is enabled by default.</para> <para> The goal of the type holes extension is not to change the type system, but to help with writing Haskell @@ -7772,11 +7775,9 @@ Failed, modules loaded: none. This ensures that an unbound identifier is never reported with a too polymorphic type, like <literal>forall a. a</literal>, when used multiple times for types that can not be unified. </para> -</sect2> - </sect1> -<!-- ==================== End of type system extensions ================= --> +<!-- ==================== Deferring type errors ================= --> <sect1 id="defer-type-errors"> <title>Deferring type errors to runtime</title> diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 0d5881fad8..7192e6ab78 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -1094,6 +1094,26 @@ test.hs:(5,4)-(6,7): <variablelist> <varlistentry> + <term><option>-fwarn-type-holes</option>:</term> + <listitem> + <indexterm><primary><option>-fwarn-type-holes</option></primary> + </indexterm> + <indexterm><primary>warnings</primary></indexterm> + <para>When the compiler encounters an unbound local + variable prefixed with <literal>_</literal>, or encounters + the literal <literal>_</literal> on the right-hand side of + an expression, the error message for the unbound term + includes the type it needs to type check. It works + particularly well with <link + linkend="defer-type-errors">deferred type errors</link>. + See <xref linkend="type-holes"/></para> + + <para>This warning is on by default.</para> + </listitem> + </varlistentry> + + + <varlistentry> <term><option>-fdefer-type-errors</option>:</term> <listitem> <indexterm><primary><option>-fdefer-type-errors</option></primary> |