#1765: :def should redefine too (ghci commands)
--------------------------------+-------------------------------------------
Reporter: guest | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 6.9
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Os: Unknown | Testcase:
Architecture: Unknown |
--------------------------------+-------------------------------------------
Changes (by guest):
* cc: [EMAIL PROTECTED] (added)
Comment:
going into a dialogue is going to interfere with scripts, so i'd advise
against that, but the issue itself is real enough.
following on from the vi-like command syntax traditionally used in hugs
and ghci, we could have:
{{{
-- list all commands, with definition texts
:def
-- list definition text of commands starting with c, if any
:def c
-- define c, fail with error message if c exists
:def c <command>
-- define c, override existing definition, if any
:def! c <command>
}}}
another issue is that of figuring out (in a script) which commands are
available. in vim, that'd be exists(":command"), which tells me if there's
a full match, a partial match (:b vs :browse), an ambiguous match
(multiple possible completions), or no match for the command name. exists
can also be used to query for options, eg., does this ghci version have
-fno-print-bind-result or not.
to make clear that this is a built-in function, i'd suggest introducing a
GHCi module, so we'd have
{{{
(GHCi.exists ":command")
(GHCi.exists "-fprint-bind-result")
}}}
the same module could also hold other information about ghci, such as
version number and available features
{{{
(GHCi.version>=[6,6,1])
(GHCi.has "debugger")
}}}
i've run into all these issues as well, in practice, when trying to define
.ghci files that work with recent ghc versions (no :cmd in 6.6.1, no :edit
and no -fprint-bind-result in 6.4.1).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1765#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs