Commit 6def8bcf authored by pcapriotti's avatar pcapriotti

Disable the MR by default in GHCi (#3202)

parent db5c6adc
...@@ -3057,6 +3057,7 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses ...@@ -3057,6 +3057,7 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
Prelude> :seti Prelude> :seti
base language is: Haskell2010 base language is: Haskell2010
with the following modifiers: with the following modifiers:
-XNoMonomorphismRestriction
-XNoDatatypeContexts -XNoDatatypeContexts
-XNondecreasingIndentation -XNondecreasingIndentation
-XExtendedDefaultRules -XExtendedDefaultRules
...@@ -3065,7 +3066,6 @@ other dynamic, non-language, flag settings: ...@@ -3065,7 +3066,6 @@ other dynamic, non-language, flag settings:
-fimplicit-import-qualified -fimplicit-import-qualified
warning settings: warning settings:
</screen> </screen>
<para> <para>
Note that the option <option>-XExtendedDefaultRules</option> Note that the option <option>-XExtendedDefaultRules</option>
is on, because we apply special defaulting rules to is on, because we apply special defaulting rules to
...@@ -3074,18 +3074,21 @@ warning settings: ...@@ -3074,18 +3074,21 @@ warning settings:
</para> </para>
<para> <para>
It is often useful to change the language options for Furthermore, the Monomorphism Restriction is disabled by default in
expressions typed at the prompt only, without having that GHCi (see <xref linkend="monomorphism" />).
option apply to loaded modules too. A good example is </para>
<screen>
:seti -XNoMonomorphismRestriction <para>
</screen> It is often useful to change the language options for expressions typed
It would be undesirable if at the prompt only, without having that option apply to loaded modules
<option>-XNoMonomorphismRestriction</option> were to apply to too. For example
loaded modules too: that might cause a compilation error, but <screen>
more commonly it will cause extra recompilation, because GHC :seti -XMonoLocalBinds
will think that it needs to recompile the module because the </screen>
flags have changed. 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>
<para> <para>
......
...@@ -359,9 +359,13 @@ interactiveUI config srcs maybe_exprs = do ...@@ -359,9 +359,13 @@ interactiveUI config srcs maybe_exprs = do
initInterpBuffering initInterpBuffering
-- The initial set of DynFlags used for interactive evaluation is the same -- 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 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 liftIO $ when (isNothing maybe_exprs) $ do
-- Only for GHCi (not runghc and ghc -e): -- Only for GHCi (not runghc and ghc -e):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment