[GHC] #1770: GHCi should know about itself,
so that .ghci can be portable
GHC
trac at haskell.org
Wed Oct 10 10:07:36 EDT 2007
#1770: GHCi should know about itself, so that .ghci can be portable
------------------------------+---------------------------------------------
Reporter: guest | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 6.6.1
Severity: normal | Keywords:
Difficulty: Unknown | Os: Unknown
Testcase: | Architecture: Unknown
------------------------------+---------------------------------------------
i've recently found myself writing .ghci files for ghc head which, with a
few changes, can be made to work with 6.6.1 as well. then someone reported
that they produce errors on his system (apparently, some people still have
to use 6.4.1, for whatever reason). there are now two versions of the
.ghci file: one for 6.4.1, one for 6.6.1 and later.
it would be useful if ghci could be queried about itself. since the query
results need to be processed further, queries should be functions. i
propose an implicitly loaded namespace GHCi. for such queries. examples:
{{{
GHCi.version :: [Int] -- version number
GHCi.info :: [(String,String)] -- the results of +RTS --info on the
current ghci
GHCi.docdir :: String -- the result of --print-docdir
GHCi.libdir :: String -- the result of --print-libdir
GHCi.exists :: String -> Bool -- commands defined, flags available
GHCi.has :: String -> Bool -- features availabe
}}}
there are an increasing number of ghc options that provide information not
easily available in ghci (calling ":!ghc --version" gives no guarantee of
reaching the right version of ghc! using Config.cProjectVersion was not
available in 6.4.1, and requires loading -package ghc, which might leave
residues/instances for the rest of the session). all of those information
flags should have ghci equivalents.
functions GHCi.exists and GHCi.has are inspired by established practice in
vim:
the former gives information about specific items (commands defined, flags
accepted), the latter gives information about more general feature sets
(debugger available? threads available?).
{{{
GHCi.exists "-fno-print-bind-result" -- false in 6.4.1
GHCi.exists ":edit" -- true from 6.6.1 on
GHCi.exists ":cmd" -- true from somewhere in 6.7.x onwards
GHCi.has "debugger" -- true from somewhere in 6.7.x onwards
}}}
no, we can't backpatch 6.4.1 or 6.6.1, but 6.8.1 will still be around when
7.x is in standard use, so the sooner the better.
(related to #1765, which was not by me;-)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1770>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list