Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 16551e78563a5b49ff9624ee1c8b8101 > files > 881

ghc-xmonad-contrib-devel-0.11-1.1.fc18.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>XMonad.Prompt.Input</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_XMonad-Prompt-Input.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/XMonad-Prompt-Input.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">xmonad-contrib-0.11: Third party extensions for xmonad</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>unportable</td></tr><tr><th>Stability</th><td>stable</td></tr><tr><th>Maintainer</th><td>&lt;byorgey@gmail.com&gt;</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">XMonad.Prompt.Input</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Usage
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A generic framework for prompting the user for input and passing it
 along to some other action.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:inputPrompt">inputPrompt</a> :: <a href="XMonad-Prompt.html#t:XPConfig">XPConfig</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/xmonad-0.11/XMonad-Core.html#t:X">X</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:inputPromptWithCompl">inputPromptWithCompl</a> :: <a href="XMonad-Prompt.html#t:XPConfig">XPConfig</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="XMonad-Prompt.html#t:ComplFunction">ComplFunction</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/xmonad-0.11/XMonad-Core.html#t:X">X</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:-63--43-">(?+)</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a) -&gt; (a -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a>) -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:InputPrompt">InputPrompt</a> </li></ul></div><div id="interface"><h1 id="g:1">Usage
</h1><div class="doc"><p>To use this module, import it along with <a href="XMonad-Prompt.html">XMonad.Prompt</a>:
</p><pre> import XMonad.Prompt
 import XMonad.Prompt.Input
</pre><p>This module provides no useful functionality in isolation, but
 is intended for use in building other actions which require user
 input.
</p><p>For example, suppose Mr. Big wants a way to easily fire his
 employees. We'll assume that he already has a function
</p><pre> fireEmployee :: String -&gt; X ()
</pre><p>which takes as input the name of an employee, and fires them.  He
 just wants a convenient way to provide the input for this function
 from within xmonad.  Here is where the <a href="XMonad-Prompt-Input.html">XMonad.Prompt.Input</a> module
 comes into play.  He can use the <code><a href="XMonad-Prompt-Input.html#v:inputPrompt">inputPrompt</a></code> function to create a
 prompt, and the <code><a href="XMonad-Prompt-Input.html#v:-63--43-">?+</a></code> operator to compose the prompt with the
 <code>fireEmployee</code> action, like so:
</p><pre> firingPrompt :: X ()
 firingPrompt = inputPrompt defaultXPConfig \&quot;Fire\&quot; ?+ fireEmployee
</pre><p>If <code>employees</code> contains a list of all his employees, he could also
 create an autocompleting version, like this:
</p><pre> firingPrompt' = inputPromptWithCompl defaultXPConfig \&quot;Fire\&quot;
                     (mkComplFunFromList employees) ?+ fireEmployee
</pre><p>Now all he has to do is add a keybinding to <code>firingPrompt</code> (or
 <code>firingPrompt'</code>), such as
</p><pre>  , ((modm .|. controlMask, xK_f),  firingPrompt)
</pre><p>Now when Mr. Big hits mod-ctrl-f, a prompt will pop up saying
 &quot;Fire: &quot;, waiting for him to type the name of someone to fire.
 If he thinks better of it after hitting mod-ctrl-f and cancels the
 prompt (e.g. by hitting Esc), the <code>fireEmployee</code> action will not be
 invoked.
</p><p>(For detailed instructions on editing your key bindings, see
 <a href="XMonad-Doc-Extending.html#Editing_key_bindings">XMonad.Doc.Extending</a>.)
</p><p><a href="XMonad-Prompt-Input.html">XMonad.Prompt.Input</a> is also intended to ease the process of
 developing other modules which require user input. For an example
 of a module developed using this functionality, see
 <a href="XMonad-Prompt-Email.html">XMonad.Prompt.Email</a>, which prompts the user for a recipient,
 subject, and one-line body, and sends a quick email.
</p></div><div class="top"><p class="src"><a name="v:inputPrompt" class="def">inputPrompt</a> :: <a href="XMonad-Prompt.html#t:XPConfig">XPConfig</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/xmonad-0.11/XMonad-Core.html#t:X">X</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)<a href="src/XMonad-Prompt-Input.html#inputPrompt" class="link">Source</a></p><div class="doc"><p>Given a prompt configuration and some prompt text, create an X
   action which pops up a prompt waiting for user input, and returns
   whatever they type.  Note that the type of the action is <code>X
   (Maybe String)</code>, which reflects the fact that the user might
   cancel the prompt (resulting in <code>Nothing</code>), or enter an input
   string <code>s</code> (resulting in <code>Just s</code>).
</p></div></div><div class="top"><p class="src"><a name="v:inputPromptWithCompl" class="def">inputPromptWithCompl</a> :: <a href="XMonad-Prompt.html#t:XPConfig">XPConfig</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="XMonad-Prompt.html#t:ComplFunction">ComplFunction</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/xmonad-0.11/XMonad-Core.html#t:X">X</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)<a href="src/XMonad-Prompt-Input.html#inputPromptWithCompl" class="link">Source</a></p><div class="doc"><p>The same as <code><a href="XMonad-Prompt-Input.html#v:inputPrompt">inputPrompt</a></code>, but with a completion function.  The
   type <code>ComplFunction</code> is <code>String -&gt; IO [String]</code>, as defined in
   <a href="XMonad-Prompt.html">XMonad.Prompt</a>.  The <code><a href="XMonad-Prompt.html#v:mkComplFunFromList">mkComplFunFromList</a></code> utility function, also
   defined in <a href="XMonad-Prompt.html">XMonad.Prompt</a>, is useful for creating such a
   function from a known list of possibilities.
</p></div></div><div class="top"><p class="src"><a name="v:-63--43-" class="def">(?+)</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a) -&gt; (a -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a>) -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/XMonad-Prompt-Input.html#%3F%2B" class="link">Source</a></p><div class="doc"><p>A combinator for hooking up an input prompt action to a function
   which can take the result of the input prompt and produce another
   action. If the user cancels the input prompt, the
   second function will not be run.
</p><p>The astute student of types will note that this is actually a
   very general combinator and has nothing in particular to do
   with input prompts.  If you find a more general use for it and
   want to move it to a different module, be my guest.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:InputPrompt" class="def">InputPrompt</a>  <a href="src/XMonad-Prompt-Input.html#InputPrompt" class="link">Source</a></p><div class="subs instances"><p id="control.i:InputPrompt" class="caption collapser" onclick="toggleSection('i:InputPrompt')">Instances</p><div id="section.i:InputPrompt" class="show"><table><tr><td class="src"><a href="XMonad-Prompt.html#t:XPrompt">XPrompt</a> <a href="XMonad-Prompt-Input.html#t:InputPrompt">InputPrompt</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>