Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
d7616541
Commit
d7616541
authored
Jul 15, 2014
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve documentation of :set/:seti
Prompted by Trac #9299
parent
9b8ba629
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
37 deletions
+47
-37
docs/users_guide/ghci.xml
docs/users_guide/ghci.xml
+46
-36
docs/users_guide/glasgow_exts.xml
docs/users_guide/glasgow_exts.xml
+1
-1
No files found.
docs/users_guide/ghci.xml
View file @
d7616541
...
...
@@ -3296,12 +3296,38 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
<title>
Setting options for interactive evaluation only
</title>
<para>
GHCi actually maintains two sets of options: one set that
applies when loading modules, and another set that applies for
expressions and commands typed at the prompt. The
<literal>
:set
</literal>
command modifies both, but there is
GHCi actually maintains
<emphasis>
two
</emphasis>
sets of options:
<itemizedlist>
<listitem><para>
The
<emphasis>
loading options
</emphasis>
apply when loading modules
</para></listitem>
<listitem><para>
The
<emphasis>
interactive options
</emphasis>
apply when evaluating expressions and commands typed at the GHCi prompt.
</para></listitem>
</itemizedlist>
The
<literal>
:set
</literal>
command modifies both, but there is
also a
<literal>
:seti
</literal>
command (for "set
interactive") that affects only the second set.
interactive") that affects only the interactive options set.
</para>
<para>
It is often useful to change the interactive options,
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>
If you are setting language options in your
<literal>
.ghci
</literal>
file, it is good practice
to use
<literal>
:seti
</literal>
rather than
<literal>
:set
</literal>
,
unless you really do want them to apply to all modules you
load in GHCi.
</para>
<para>
...
...
@@ -3309,8 +3335,6 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
<literal>
:set
</literal>
and
<literal>
:seti
</literal>
commands
respectively, with no arguments. For example, in a clean GHCi
session we might see something like this:
</para>
<screen>
Prelude> :seti
base language is: Haskell2010
...
...
@@ -3324,38 +3348,24 @@ 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
</para>
<para>
The two sets of options are initialised as follows. First, both sets of options
are initialised as described in
<xref
linkend=
"ghci-dot-files"
/>
.
Then the interactive options are modified as follows:
<itemizedlist>
<listitem><para>
The option
<option>
-XExtendedDefaultRules
</option>
is enabled, in order to apply special defaulting rules to
expressions typed at the prompt (see
<xref
linkend=
"extended-default-rules"
/>
).
</para>
<para>
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></listitem>
<para>
It is therefore good practice if you are setting language
options in your
<literal>
.ghci
</literal>
file, to use
<literal>
:seti
</literal>
rather than
<literal>
:set
</literal>
unless you really do want them to apply to all modules you
load in GHCi.
</para>
<listitem>
<para>
The Monomorphism Restriction is disabled (see
<xref
linkend=
"monomorphism"
/>
).
</para></listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
...
...
docs/users_guide/glasgow_exts.xml
View file @
d7616541
...
...
@@ -8162,7 +8162,7 @@ scope over the methods defined in the <literal>where</literal> part. For exampl
of the Haskell Report)
can be completely switched off by
<option>
-XNoMonomorphismRestriction
</option>
. Since GHC 7.8.1, the monomorphism
restriction is switched off by default in GHCi.
restriction is switched off by default in GHCi
's interactive options (see
<xref
linkend=
"ghci-interactive-options"
/>
)
.
</para>
</sect3>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment