/usr/share/doc/libghc-blogliterately-doc/html/Text-BlogLiterately-Ghci.html is in libghc-blogliterately-doc 0.8.1.5-1.
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 | <!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>Text.BlogLiterately.Ghci</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_Text-BlogLiterately-Ghci.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-BlogLiterately-Ghci.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">BlogLiterately-0.8.1.5: A tool for posting Haskelly articles to blogs</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) 1997-2005 Ralf Hinze <ralf.hinze@comlab.ox.ac.uk>, Andres Loeh <lhs2tex@andres-loeh.de>, 2012 Brent Yorgey</td></tr><tr><th>License</th><td>GPL (see LICENSE)</td></tr><tr><th>Maintainer</th><td>Brent Yorgey <byorgey@gmail.com></td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.BlogLiterately.Ghci</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Running ghci</a></li><li><a href="#g:2">Extracting output</a></li><li><a href="#g:3">Formatting</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Format specially marked blocks as interactive ghci sessions. Uses
some ugly but effective code for interacting with an external ghci
process taken from lhs2TeX.</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"><span class="keyword">type</span> <a href="#t:ProcessInfo">ProcessInfo</a> = (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/process-1.2.3.0/System-Process.html#t:ProcessHandle">ProcessHandle</a>)</li><li class="src short"><a href="#v:ghciEval">ghciEval</a> :: GhciInput -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> <a href="Text-BlogLiterately-Ghci.html#t:ProcessInfo">ProcessInfo</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> GhciOutput</li><li class="src short"><a href="#v:withGhciProcess">withGhciProcess</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> <a href="Text-BlogLiterately-Ghci.html#t:ProcessInfo">ProcessInfo</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:isLiterate">isLiterate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:stopGhci">stopGhci</a> :: <a href="Text-BlogLiterately-Ghci.html#t:ProcessInfo">ProcessInfo</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:magic">magic</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:extract-39-">extract'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:extract">extract</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:breaks">breaks</a> :: ([a] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -> [a] -> ([a], [a])</li><li class="src short"><a href="#v:formatInlineGhci">formatInlineGhci</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/libghc-pandoc-types-doc/html/Text-Pandoc-Definition.html#t:Pandoc">Pandoc</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-pandoc-types-doc/html/Text-Pandoc-Definition.html#t:Pandoc">Pandoc</a></li></ul></div><div id="interface"><h1 id="g:1">Running ghci</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:ProcessInfo" class="def">ProcessInfo</a> = (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/process-1.2.3.0/System-Process.html#t:ProcessHandle">ProcessHandle</a>) <a href="src/Text-BlogLiterately-Ghci.html#ProcessInfo" class="link">Source</a></p><div class="doc"><p>Information about a running process: stdin, stdout, stderr, and a
handle.</p></div></div><div class="top"><p class="src"><a name="v:ghciEval" class="def">ghciEval</a> :: GhciInput -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> <a href="Text-BlogLiterately-Ghci.html#t:ProcessInfo">ProcessInfo</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> GhciOutput <a href="src/Text-BlogLiterately-Ghci.html#ghciEval" class="link">Source</a></p><div class="doc"><p>Evaluate an expression using an external <code>ghci</code> process.</p></div></div><div class="top"><p class="src"><a name="v:withGhciProcess" class="def">withGhciProcess</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> <a href="Text-BlogLiterately-Ghci.html#t:ProcessInfo">ProcessInfo</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a <a href="src/Text-BlogLiterately-Ghci.html#withGhciProcess" class="link">Source</a></p><div class="doc"><p>Start an external ghci process, run a computation with access to
it, and finally stop the process.</p></div></div><div class="top"><p class="src"><a name="v:isLiterate" class="def">isLiterate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Text-BlogLiterately-Ghci.html#isLiterate" class="link">Source</a></p><div class="doc"><p>Poor man's check to see whether we have a literate Haskell file.</p></div></div><div class="top"><p class="src"><a name="v:stopGhci" class="def">stopGhci</a> :: <a href="Text-BlogLiterately-Ghci.html#t:ProcessInfo">ProcessInfo</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> () <a href="src/Text-BlogLiterately-Ghci.html#stopGhci" class="link">Source</a></p><div class="doc"><p>Stop a ghci process by passing it <code>:q</code> and waiting for it to exit.</p></div></div><h1 id="g:2">Extracting output</h1><div class="doc"><p>To extract the answer from <code>ghci</code>'s output we use a simple technique
which should work in most cases: we print the string <code>magic</code> before
and after the expression we are interested in. We assume that
everything that appears before the first occurrence of <code>magic</code> on the
same line is the prompt, and everything between the first <code>magic</code> and
the second <code>magic</code> plus prompt is the result we look for.</p></div><div class="top"><p class="src"><a name="v:magic" class="def">magic</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> <a href="src/Text-BlogLiterately-Ghci.html#magic" class="link">Source</a></p><div class="doc"><p>There is nothing magic about the magic string.</p></div></div><div class="top"><p class="src"><a name="v:extract-39-" class="def">extract'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> <a href="src/Text-BlogLiterately-Ghci.html#extract%27" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:extract" class="def">extract</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> <a href="src/Text-BlogLiterately-Ghci.html#extract" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:breaks" class="def">breaks</a> :: ([a] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -> [a] -> ([a], [a]) <a href="src/Text-BlogLiterately-Ghci.html#breaks" class="link">Source</a></p></div><h1 id="g:3">Formatting</h1><div class="top"><p class="src"><a name="v:formatInlineGhci" class="def">formatInlineGhci</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/libghc-pandoc-types-doc/html/Text-Pandoc-Definition.html#t:Pandoc">Pandoc</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-pandoc-types-doc/html/Text-Pandoc-Definition.html#t:Pandoc">Pandoc</a> <a href="src/Text-BlogLiterately-Ghci.html#formatInlineGhci" class="link">Source</a></p><div class="doc"><p>Given the path to the <code>.lhs</code> source and its representation as a
<code>Pandoc</code> document, <code>formatInlineGhci</code> finds any <code>[ghci]</code> blocks
in it, runs them through <code>ghci</code>, and formats the results as an
interactive <code>ghci</code> session.</p><p>Lines beginning in the first column of the block are interpreted
as inputs. Lines indented by one or more space are interpreted
as <em>expected outputs</em>. Consecutive indented lines are
interpreted as one multi-line expected output, with a number of
spaces removed from the beginning of each line equal to the
number of spaces at the start of the first indented line.</p><p>If the output for a given input is the same as the expected
output (or if no expected output is given), the result is typeset
normally. If the actual and expected outputs differ, the actual
output is typeset first in red, then the expected output in blue.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|