diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2015-07-17 00:02:09 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-07-17 00:07:30 +0200 |
commit | ae96c751c869813ab95e712f8daac8516bb4795f (patch) | |
tree | be6c84598963debb99019cb1a90367e5097aedba /docs | |
parent | 82f1c78718828e0b49fc6f6ed140234e016e4c7a (diff) | |
download | haskell-ae96c751c869813ab95e712f8daac8516bb4795f.tar.gz |
Implement -fprint-expanded-synonyms
Add a flag to print type-synonyms-expanded versions of types in type
error messages (in addition to old error messages with synonyms)
* Mailing list discussion: https://mail.haskell.org/pipermail/ghc-devs/2015-June/009247.html
* Wiki page: https://wiki.haskell.org/Expanding_type_synonyms_in_error_messages_proposal
* Trac: https://ghc.haskell.org/trac/ghc/ticket/10547
Test Plan:
* I'll find some examples and add tests.
Reviewers: austin, simonpj, goldfire, bgamari
Reviewed By: austin, simonpj, goldfire, bgamari
Subscribers: rodlogic, thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D1016
GHC Trac Issues: #10547
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/7.12.1-notes.xml | 8 | ||||
-rw-r--r-- | docs/users_guide/flags.xml | 6 | ||||
-rw-r--r-- | docs/users_guide/using.xml | 42 |
3 files changed, 55 insertions, 1 deletions
diff --git a/docs/users_guide/7.12.1-notes.xml b/docs/users_guide/7.12.1-notes.xml index dc191d2638..cc9dd37dbb 100644 --- a/docs/users_guide/7.12.1-notes.xml +++ b/docs/users_guide/7.12.1-notes.xml @@ -85,6 +85,14 @@ This is similar to using <option>-ddump-to-file</option> with <option>-ddump-splices</option> but it always generates a file instead of being coupled to <option>-ddump-to-file</option> and only outputs code that does not exist in the .hs file and a comment for the splice location in the original file. </para> </listitem> + <listitem> + <para> + Added the option <option>-fprint-expanded-types</option>. + + When enabled, GHC also prints type-synonym-expanded types in + type errors. + </para> + </listitem> </itemizedlist> </sect3> diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 928c6275b9..e3ae927649 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -54,6 +54,12 @@ <entry>-fno-print-unicode-syntax</entry> </row> <row> + <entry><option>-fprint-expanded-synonyms</option></entry> + <entry>In type errors, also print type-synonym-expanded types.</entry> + <entry>dynamic</entry> + <entry>-fno-print-expanded-synonyms</entry> + </row> + <row> <entry><option>-ferror-spans</option></entry> <entry>output full span in error messages</entry> <entry>dynamic</entry> diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 58008a2ade..772e8b9eaa 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -896,7 +896,7 @@ ghc -c Foo.hs <varlistentry> - <term><option>--fprint-explicit-foralls, -fprint-explicit-kinds, -fprint-unicode-syntax</option> + <term><option>-fprint-explicit-foralls, -fprint-explicit-kinds, -fprint-unicode-syntax</option> <indexterm><primary><option>-fprint-explicit-foralls</option></primary></indexterm> <indexterm><primary><option>-fprint-explicit-kinds</option></primary></indexterm> <indexterm><primary><option>-fprint-unicode-syntax</option></primary></indexterm> @@ -960,6 +960,46 @@ ghci> :t (>>) </varlistentry> <varlistentry> + <term> + <option>-fprint-expanded-synonyms</option> + <indexterm><primary><option>-fprint-expanded-synonyms</option></primary></indexterm> + </term> + <listitem> + <para> + When enabled, GHC also prints type-synonym-expanded types in type + errors. + + For example, with this type synonyms: + +<screen> +type Foo = Int +type Bar = Bool +type MyBarST s = ST s Bar +</screen> + + This error message: + +<screen> +Couldn't match type 'Int' with 'Bool' +Expected type: ST s Foo + Actual type: MyBarST s +</screen> + + Becomes this: + +<screen> +Couldn't match type 'Int' with 'Bool' +Expected type: ST s Foo + Actual type: MyBarST s +Type synonyms expanded: +Expected type: ST s Int + Actual type: ST s Bool +</screen> + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>-ferror-spans</option> <indexterm><primary><option>-ferror-spans</option></primary> </indexterm> |