Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
991f1419
Commit
991f1419
authored
Jun 19, 2011
by
SamAnklesaria
Committed by
Ian Lynagh
Jun 26, 2011
Browse files
trac #5265 (support for additional .ghci files)
parent
8023014e
Changes
4
Hide whitespace changes
Inline
Side-by-side
compiler/main/StaticFlags.hs
View file @
991f1419
...
...
@@ -72,6 +72,7 @@ module StaticFlags (
-- misc opts
opt_IgnoreDotGhci
,
opt_GhciScripts
,
opt_ErrorSpans
,
opt_GranMacros
,
opt_HiVersion
,
...
...
@@ -92,7 +93,7 @@ module StaticFlags (
import
Config
import
FastString
import
Util
import
Maybes
(
firstJusts
)
import
Maybes
(
firstJusts
,
catMaybes
)
import
Panic
import
Data.Maybe
(
listToMaybe
)
...
...
@@ -121,6 +122,7 @@ lookUp :: FastString -> Bool
lookup_def_int
::
String
->
Int
->
Int
lookup_def_float
::
String
->
Float
->
Float
lookup_str
::
String
->
Maybe
String
lookup_all_str
::
String
->
[
String
]
-- holds the static opts while they're being collected, before
-- being unsafely read by unpacked_static_opts below.
...
...
@@ -151,6 +153,10 @@ lookup_str sw
Just
str
->
Just
str
Nothing
->
Nothing
lookup_all_str
sw
=
map
f
$
catMaybes
(
map
(
stripPrefix
sw
)
staticFlags
)
where
f
(
'='
:
str
)
=
str
f
str
=
str
lookup_def_int
sw
def
=
case
(
lookup_str
sw
)
of
Nothing
->
def
-- Use default
Just
xx
->
try_read
sw
xx
...
...
@@ -189,6 +195,9 @@ unpacked_opts =
opt_IgnoreDotGhci
::
Bool
opt_IgnoreDotGhci
=
lookUp
(
fsLit
"-ignore-dot-ghci"
)
opt_GhciScripts
::
[
String
]
opt_GhciScripts
=
lookup_all_str
"-ghci-script"
-- debugging options
-- | Suppress all that is suppressable in core dumps.
...
...
docs/users_guide/flags.xml
View file @
991f1419
...
...
@@ -486,6 +486,12 @@
<entry>
static
</entry>
<entry>
-
</entry>
</row>
<row>
<entry><option>
-ghci-script
</option></entry>
<entry>
Load the given additional
<filename>
.ghci
</filename>
file
</entry>
<entry>
static
</entry>
<entry>
-
</entry>
</row>
<row>
<entry><option>
-read-dot-ghci
</option></entry>
<entry>
Enable reading of
<filename>
.ghci
</filename>
files
</entry>
...
...
docs/users_guide/ghci.xml
View file @
991f1419
...
...
@@ -2872,6 +2872,10 @@ Prelude> :set -fno-glasgow-exts
</varlistentry>
</variablelist>
<para>
Additional
<filename>
.ghci
</filename>
files can be added
through the
<option>
-ghci-script
</option>
option. These are
loaded after the normal
<filename>
.ghci
</filename>
files.
</para>
</sect1>
<sect1
id=
"ghci-obj"
>
...
...
ghc/InteractiveUI.hs
View file @
991f1419
...
...
@@ -426,7 +426,8 @@ runGHCi paths maybe_exprs = do
getDirectory
f
=
case
takeDirectory
f
of
""
->
"."
;
d
->
d
when
(
read_dot_files
)
$
do
mcfgs0
<-
sequence
[
current_dir
,
app_user_dir
,
home_dir
]
mcfgs0
<-
sequence
$
[
current_dir
,
app_user_dir
,
home_dir
]
++
map
(
return
.
Just
)
opt_GhciScripts
mcfgs
<-
liftIO
$
mapM
canonicalizePath'
(
catMaybes
mcfgs0
)
mapM_
sourceConfigFile
$
nub
$
catMaybes
mcfgs
-- nub, because we don't want to read .ghci twice if the
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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