/usr/share/doc/libghc-hsh-doc/html/HSH.html is in libghc-hsh-doc 2.1.0-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | <!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>HSH</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_HSH.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/HSH.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">HSH-2.1.0: Library to mix shell scripting with Haskell programs</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>John Goerzen <jgoerzen@complete.org> </td></tr><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">HSH</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Copyright (c) 2006 John Goerzen, jgoerzen@complete.org
</p><p>Welcome to HSH, the Haskell Shell infrastructure.
</p><p><a href="http://software.complete.org/hsh">http://software.complete.org/hsh</a>
</p><p>HSH is designed to let you mix and match shell expressions with Haskell
programs.
</p><p>Here are a few examples to get you started:
</p><pre>run $ "echo /etc/pass*" :: IO String
-> "/etc/passwd /etc/passwd-"
runIO $ "ls -l" -|- "wc -l"
-> 12
runIO $ "ls -l" -|- wcL
-> 12
runIO $ ("ls", ["-l", "file with spaces.txt"])
glob "~jgoerzen" >>= cd . head
</pre><p>wcL is a pure Haskell function defined in <a href="HSH-ShellEquivs-wcL.html">HSH.ShellEquivs.wcL</a> as:
</p><pre>wcL :: [String] -> [String]
wcL inp = [show $ genericLength inp]
</pre><p>Here's another example:
</p><pre> let countLines = (zipWith (\i line -> printf "%-5d %s" i line)
[(1::Int)..])::([String] -> [String])
runIO $ ("ls", ["-l"]) -|- countLines -|- filter (isSuffixOf "hs")
6 -rw-r--r-- 1 jgoerzen jgoerzen 1285 Jun 6 09:43 HSH.hs
11 -rw-r--r-- 1 jgoerzen jgoerzen 565 Jun 6 09:43 test.hs
</pre><p>To use HSH, you'll just want to import the HSH module. To learn more,
please see the information in <a href="HSH-Command.html">HSH.Command</a> and <a href="HSH-ShellEquivs.html">HSH.ShellEquivs</a>.
</p><p>You can run a command with HSH in several ways:
</p><ul><li> By using <code><a href="HSH-Command.html#v:run">run</a></code> in a context that expects IO (), which will leave
the final standard output going
to the normal standard output of the program
</li><li> By using <code><a href="HSH-Command.html#v:run">run</a></code> in a context that expects a String, which will
capture standard output into a buffer and present it as a String
</li><li> Any of the numerous other methods documented in <code><a href="HSH-Command.html#t:RunResult">RunResult</a></code>.
</li><li> The shortcut functions <code><a href="HSH-Command.html#v:runIO">runIO</a></code> and <code><a href="HSH-Command.html#v:runSL">runSL</a></code>. <code><a href="HSH-Command.html#v:runIO">runIO</a></code> lets you run
a command and force the context IO (), which is a frequently-useful
shortcut when you don't care about the result. <code><a href="HSH-Command.html#v:runSL">runSL</a></code> grabs the
first line of output in the result.
</li></ul><p>You can then specify a command, which could be a single command or a command
joined together with pipes.
</p><p>There are many different items that make valid types; see the list of
instances of <code><a href="HSH-Command.html#t:ShellCommand">ShellCommand</a></code> for a full list. Here are a few:
</p><ul><li> A simple bare string is passed to the shell for execution. The shell
will then typically expand wildcards, parse parameters, etc.
</li><li> A <code>(String, [String])</code> tuple. The first item in the tuple gives
the name of a program to run, and the second gives its arguments.
The shell is never involved. This is ideal for passing filenames,
since there is no security risk involving special shell characters.
</li><li> A Haskell function. This function will accept input representing
its standard input and generate output to go to stdout. Function
types that are supported natively include <code>(String -> String)</code>,
<code>(String -> IO String)</code>, plus many more involving ByteStrings and functions
that take no input. See <code><a href="HSH-Command.html#t:ShellCommand">ShellCommand</a></code> for more.
</li></ul><p>Pipes can be constructed by using the -|- operator, as illustrated above.
It is quite possible to pipe data between Haskell functions and
shell commands at will.
</p><p>In addition, <a href="HSH-ShellEquivs.html">HSH.ShellEquivs</a> provides a number of useful pure-Haskell
equivalents of regular shell commands.
</p><p>For more information, please consult the other modules in HSH as well as
the HSH wiki at:
</p><p><a href="http://software.complete.org/hsh">http://software.complete.org/hsh</a>
</p></div></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="HSH-Command.html">HSH.Command</a></p></div><div class="top"><p class="src">module <a href="HSH-ShellEquivs.html">HSH.ShellEquivs</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|