diff options
author | Merijn Verstraaten <merijn@inconsistent.nl> | 2014-11-21 15:32:38 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-11-21 17:04:57 -0600 |
commit | 2cc854b7133e38c7ad1107057931761782d03594 (patch) | |
tree | 399b3ccdcc7c43dce2e598d1ea42e72ff818000c /docs/users_guide/using.xml | |
parent | 624a7c5a2eee0c0ba486a45550680052c2c79849 (diff) | |
download | haskell-2cc854b7133e38c7ad1107057931761782d03594.tar.gz |
Add -fdefer-typed-holes flag which defers hole errors to runtime.
Summary:
As proposed by Richard on Trac. This patch adds a new flag -fdefer-typed-holes
and changes the semantics of the -fno-warn-typed-holes flag.
To summarise, by default GHC has typed holes enabled and produces a compile
error when it encounters a typed hole.
When -fdefer-type-errors OR -fdefer-typed-holes is enabled, hole errors are
converted to warnings and result in runtime errors when evaluated.
The warning flag -fwarn-typed-holes is on by default. Without -fdefer-type-errors
or -fdefer-typed-holes this flag is a no-op, since typed holes are an error
under these conditions. If either of the defer flags are enabled (converting
typed hole errors into warnings) the -fno-warn-typed-holes flag disables the
warnings. This means compilation silently succeeds and evaluating a hole will
produce a runtime error.
The rationale behind allowing typed holes warnings to be silenced is that tools
like Syntastic for vim highlight warnings and hole warnings may be undesirable.
Signed-off-by: Merijn Verstraaten <merijn@inconsistent.nl>
Test Plan: validate
Reviewers: austin, simonpj, thomie
Reviewed By: simonpj, thomie
Subscribers: Fuuzetsu, thomie, carter
Differential Revision: https://phabricator.haskell.org/D442
GHC Trac Issues: #9497
Conflicts:
compiler/main/DynFlags.hs
Diffstat (limited to 'docs/users_guide/using.xml')
-rw-r--r-- | docs/users_guide/using.xml | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index a3b3d05d08..309be8cf23 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -1131,14 +1131,11 @@ test.hs:(5,4)-(6,7): <indexterm><primary><option>-fwarn-typed-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="typed-holes"/></para> + <para> + Determines whether the compiler reports typed holes warnings. Has + no effect unless typed holes errors are deferred until runtime. + See <xref linkend="typed-holes"/> and <xref linkend="defer-type-errors"/> + </para> <para>This warning is on by default.</para> </listitem> @@ -1160,6 +1157,27 @@ test.hs:(5,4)-(6,7): </varlistentry> <varlistentry> + <term><option>-fdefer-typed-holes</option>:</term> + <listitem> + <indexterm><primary><option>-fdefer-typed-holes</option></primary> + </indexterm> + <indexterm><primary>warnings</primary></indexterm> + <para> + Defer typed holes errors until runtime. This will turn the errors + produced by <link linked="typed-holes">typed holes</link> into + warnings. Using a value that depends on a typed hole produces a + runtime error, the same as <option>-fdefer-type-errors</option> + (which implies this option). See <xref linkend="typed-holes"/> + and <xref linkend="defer-type-errors"/>. + </para> + <para> + Implied by <option>-fdefer-type-errors</option>. See also + <option>-fwarn-typed-holes</option>. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>-fhelpful-errors</option>:</term> <listitem> <indexterm><primary><option>-fhelpful-errors</option></primary> |