summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2013-11-07 07:55:26 -0600
committerAustin Seipp <austin@well-typed.com>2013-11-07 07:56:24 -0600
commitb459c35744d067ee05674012323d13a49bc09ea2 (patch)
treeccfee59921150581b9651f4e673b64b8e191181d /docs
parentf9b3ff49fd0bf78930be7c0d07562e933c95cd9e (diff)
downloadhaskell-b459c35744d067ee05674012323d13a49bc09ea2.tar.gz
Add docs for #8305
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/ghci.xml55
1 files changed, 55 insertions, 0 deletions
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index de95182026..e593775e81 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -3420,6 +3420,61 @@ warning settings:
</varlistentry>
</variablelist>
+ <para>
+ When defining GHCi macros, there is some important behavior you
+ should be aware of when names may conflict with built-in
+ commands, especially regarding tab completion.
+ </para>
+ <para>
+ For example, consider if you had a macro named
+ <literal>:time</literal> and in the shell, typed <literal>:t
+ 3</literal> - what should happen? The current algorithm we use
+ for completing commands is:
+
+ <orderedlist>
+ <listitem>
+ <para>First, look up an exact match on the name from the defined macros.</para>
+ </listitem>
+ <listitem>
+ <para>Look for the exact match on the name in the built-in command list.</para>
+ </listitem>
+ <listitem>
+ <para>Do a prefix lookup on the list of built-in commands -
+ if a built-in command matches, but a macro is defined with
+ the same name as the built-in defined, pick the
+ macro.</para>
+ </listitem>
+ <listitem>
+ <para>Do a prefix lookup on the list of built-in commands.</para>
+ </listitem>
+ <listitem>
+ <para>Do a prefix lookup on the list of defined macros.</para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ Here are some examples:
+
+ <orderedlist>
+ <listitem>
+ <para>You have a macro <literal>:time</literal> and enter <literal>:t 3</literal></para>
+ <para>You get <literal>:type 3</literal></para>
+ </listitem>
+
+ <listitem>
+ <para>You have a macro <literal>:type</literal> and enter <literal>:t 3</literal></para>
+ <para>You get <literal>:type 3</literal> with your defined macro, not the builtin.</para>
+ </listitem>
+
+ <listitem>
+ <para>You have a macro <literal>:time</literal> and a macro
+ <literal>:type</literal>, and enter <literal>:t
+ 3</literal></para>
+ <para>You get <literal>:type 3</literal> with your defined macro.</para>
+ </listitem>
+ </orderedlist>
+ </para>
</sect1>
<sect1 id="ghci-obj">