Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/26b2caf02f8999f115de72f0cfa7b39c93b17296 >--------------------------------------------------------------- commit 26b2caf02f8999f115de72f0cfa7b39c93b17296 Author: Simon Peyton Jones <simo...@microsoft.com> Date: Fri Oct 26 16:18:03 2012 +0100 Make Rank2Types and PolymorphicComponents into a synonym for RankNTypes (no deprecation) There was a long thread on cvs-ghc which concluded that although it's the Right Thing to deprecate Rank2Types and PolymorphicComponents, in favour of RankNTypes, it would cause lots of busy-work for library authors and the pain isn't worth the gain. So this patch removes the deprecation, and documents the synonym-ity. >--------------------------------------------------------------- compiler/main/DynFlags.hs | 8 ++++---- docs/users_guide/flags.xml | 6 ++---- docs/users_guide/glasgow_exts.xml | 31 +++++++++++++------------------ 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index ac1fe9a..4cef95e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -2457,11 +2457,11 @@ xFlags = [ ( "CApiFFI", Opt_CApiFFI, nop ), ( "GHCForeignImportPrim", Opt_GHCForeignImportPrim, nop ), ( "LiberalTypeSynonyms", Opt_LiberalTypeSynonyms, nop ), - ( "PolymorphicComponents", Opt_RankNTypes, - deprecatedForExtension "RankNTypes" ), - ( "Rank2Types", Opt_RankNTypes, - deprecatedForExtension "RankNTypes" ), + + ( "PolymorphicComponents", Opt_RankNTypes, nop), + ( "Rank2Types", Opt_RankNTypes, nop), ( "RankNTypes", Opt_RankNTypes, nop ), + ( "ImpredicativeTypes", Opt_ImpredicativeTypes, nop), ( "TypeOperators", Opt_TypeOperators, nop ), ( "ExplicitNamespaces", Opt_ExplicitNamespaces, nop ), diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 499c828..d670cb9 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -914,9 +914,7 @@ <entry>Enable <link linkend="explicit-foralls">explicit universal quantification</link>. Implied by <option>-XScopedTypeVariables</option>, <option>-XLiberalTypeSynonyms</option>, - <option>-XRank2Types</option>, <option>-XRankNTypes</option>, - <option>-XPolymorphicComponents</option>, <option>-XExistentialQuantification</option> </entry> <entry>dynamic</entry> @@ -925,13 +923,13 @@ <row> <entry><option>-XPolymorphicComponents</option></entry> <entry>Enable <link linkend="universal-quantification">polymorphic components for data constructors</link>.</entry> - <entry>dynamic</entry> + <entry>dynamic, synonym for <option>-XRankNTypes</option></entry> <entry><option>-XNoPolymorphicComponents</option></entry> </row> <row> <entry><option>-XRank2Types</option></entry> <entry>Enable <link linkend="universal-quantification">rank-2 types</link>.</entry> - <entry>dynamic</entry> + <entry>dynamic, synonym for <option>-XRankNTypes</option></entry> <entry><option>-XNoRank2Types</option></entry> </row> <row> diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 7607aa7..b036674 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -2071,9 +2071,7 @@ The following syntax is stolen: Stolen (in types) by: <option>-XExplicitForAll</option>, and hence by <option>-XScopedTypeVariables</option>, <option>-XLiberalTypeSynonyms</option>, - <option>-XRank2Types</option>, <option>-XRankNTypes</option>, - <option>-XPolymorphicComponents</option>, <option>-XExistentialQuantification</option> </para></listitem> </varlistentry> @@ -6384,20 +6382,12 @@ The function <literal>f3</literal> has a rank-3 type; it has rank-2 types on the left of a function arrow. </para> <para> -GHC has three flags to control higher-rank types. (All three imply <option>-XExplicitForAll</option>, <xref linkend="explicit-foralls"/>.) -<itemizedlist> -<listitem><para> - <option>-XPolymorphicComponents</option>: data constructors (only) can have polymorphic argument types. -</para></listitem> -<listitem><para> - <option>-XRank2Types</option>: any function (including data constructors) can have a rank-2 type. -</para></listitem> -<listitem><para> - <option>-XRankNTypes</option>: any function (including data constructors) can have an arbitrary-rank type. -That is, you can nest <literal>forall</literal>s +The language option <option>-XRankNTypes</option> (which implies <option>-XExplicitForAll</option>, <xref linkend="explicit-foralls"/>) +enables higher-rank types. +That is, you can nest <literal>forall</literal>s arbitrarily deep in function arrows. -In particular, a forall-type (also called a "type scheme"), -including an operational type class context, is legal: +For example, a forall-type (also called a "type scheme"), +including a type-class context, is legal: <itemizedlist> <listitem> <para> On the left or right (see <literal>f4</literal>, for example) of a function arrow </para> </listitem> @@ -6407,15 +6397,20 @@ field type signatures.</para> </listitem> <listitem> <para> As the type of an implicit parameter </para> </listitem> <listitem> <para> In a pattern type signature (see <xref linkend="scoped-type-variables"/>) </para> </listitem> </itemizedlist> -</para></listitem> -</itemizedlist> -Either <option>-XRank2Types</option> or <option>-XRankNTypes</option> is also required for any +The <option>-XRankNTypes</option> option is also required for any type with a <literal>forall</literal> or context to the right of an arrow (e.g. <literal>f :: Int -> forall a. a->a</literal>, or <literal>g :: Int -> Ord a => a -> a</literal>). Such types are technically rank 1, but are clearly not Haskell-98, and an extra flag did not seem worth the bother. </para> +<para> +The obselete language options <option>-XPolymorphicComponents</option> and <option>-XRank2Types</option> +are synonyms for <option>-XRankNTypes</option>. They used to specify finer distinctions that +GHC no longer makes. (They should really elicit a deprecation warning, but they don't, purely +to avoid the need to library authors to change their old flags specifciations.) +</para> + <sect3 id="univ"> <title>Examples </title> _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc