Add -fdefer-typed-holes flag which defers hole errors to runtime.
authorMerijn Verstraaten <merijn@inconsistent.nl>
Fri, 21 Nov 2014 21:32:38 +0000 (15:32 -0600)
committerAustin Seipp <austin@well-typed.com>
Fri, 21 Nov 2014 23:04:57 +0000 (17:04 -0600)
commit2cc854b7133e38c7ad1107057931761782d03594
tree399b3ccdcc7c43dce2e598d1ea42e72ff818000c
parent624a7c5a2eee0c0ba486a45550680052c2c79849
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
27 files changed:
compiler/main/DynFlags.hs
compiler/rename/RnExpr.lhs
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcErrors.lhs
compiler/typecheck/TcRnDriver.lhs
docs/users_guide/flags.xml
docs/users_guide/glasgow_exts.xml
docs/users_guide/using.xml
testsuite/tests/module/mod71.stderr
testsuite/tests/rename/should_fail/rnfail016.stderr
testsuite/tests/typecheck/should_compile/T9497a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T9497a.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T9497b.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T9497b.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T9497c.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T9497c.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_fail/T9497d.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T9497d.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T
testsuite/tests/typecheck/should_run/T9497a-run.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T9497a-run.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T9497b-run.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T9497b-run.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T9497c-run.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T9497c-run.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_run/all.T