Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/6def8bcf537eda726e7ae493a3fb73104ee129e5

>---------------------------------------------------------------

commit 6def8bcf537eda726e7ae493a3fb73104ee129e5
Author: Paolo Capriotti <[email protected]>
Date:   Sun Sep 2 17:40:51 2012 +0100

    Disable the MR by default in GHCi (#3202)

>---------------------------------------------------------------

 docs/users_guide/ghci.xml |   29 ++++++++++++++++-------------
 ghc/InteractiveUI.hs      |    8 ++++++--
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index c7d3cc5..94be422 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -3057,6 +3057,7 @@ Prelude> :set -fno-warn-incomplete-patterns 
-XNoMultiParamTypeClasses
 Prelude> :seti
 base language is: Haskell2010
 with the following modifiers:
+  -XNoMonomorphismRestriction
   -XNoDatatypeContexts
   -XNondecreasingIndentation
   -XExtendedDefaultRules
@@ -3065,7 +3066,6 @@ other dynamic, non-language, flag settings:
   -fimplicit-import-qualified
 warning settings:
 </screen>
-
       <para>
         Note that the option <option>-XExtendedDefaultRules</option>
         is on, because we apply special defaulting rules to
@@ -3074,18 +3074,21 @@ warning settings:
       </para>
 
       <para>
-        It is often useful to change the language options for
-        expressions typed at the prompt only, without having that
-        option apply to loaded modules too.  A good example is
-<screen>
-:seti -XNoMonomorphismRestriction
-</screen>
-        It would be undesirable if
-        <option>-XNoMonomorphismRestriction</option> were to apply to
-        loaded modules too: that might cause a compilation error, but
-        more commonly it will cause extra recompilation, because GHC
-        will think that it needs to recompile the module because the
-        flags have changed.
+        Furthermore, the Monomorphism Restriction is disabled by default in
+        GHCi (see <xref linkend="monomorphism" />).
+      </para>
+
+      <para>
+        It is often useful to change the language options for expressions typed
+        at the prompt only, without having that option apply to loaded modules
+        too.  For example
+<screen>
+:seti -XMonoLocalBinds
+</screen>
+        It would be undesirable if <option>-XMonoLocalBinds</option> were to
+        apply to loaded modules too: that might cause a compilation error, but
+        more commonly it will cause extra recompilation, because GHC will think
+        that it needs to recompile the module because the flags have changed.
       </para>
 
       <para>
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 9eab445..60748ba 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -359,9 +359,13 @@ interactiveUI config srcs maybe_exprs = do
    initInterpBuffering
 
    -- The initial set of DynFlags used for interactive evaluation is the same
-   -- as the global DynFlags, plus -XExtendedDefaultRules
+   -- as the global DynFlags, plus -XExtendedDefaultRules and
+   -- -XNoMonomorphismRestriction.
    dflags <- getDynFlags
-   GHC.setInteractiveDynFlags (xopt_set dflags Opt_ExtendedDefaultRules)
+   let dflags' = (`xopt_set` Opt_ExtendedDefaultRules)
+               . (`xopt_unset` Opt_MonomorphismRestriction)
+               $ dflags
+   GHC.setInteractiveDynFlags dflags'
 
    liftIO $ when (isNothing maybe_exprs) $ do
         -- Only for GHCi (not runghc and ghc -e):



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to