/usr/share/doc/libghc-parsec3-doc/html/Text-Parsec-Expr.html is in libghc-parsec3-doc 3.1.11-3build2.
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 | <!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.Parsec.Expr</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Text-Parsec-Expr.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-Parsec-Expr.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">parsec-3.1.11: Monadic parser combinators</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) Daan Leijen 1999-2001 (c) Paolo Martini 2007</td></tr><tr><th>License</th><td>BSD-style (see the LICENSE file)</td></tr><tr><th>Maintainer</th><td>derek.a.elkins@gmail.com</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>non-portable</td></tr><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Text.Parsec.Expr</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A helper module to parse "expressions".
Builds a parser given a table of operators and associativities.</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">data</span> <a href="#t:Assoc">Assoc</a><ul class="subs"><li>= <a href="#v:AssocNone">AssocNone</a></li><li>| <a href="#v:AssocLeft">AssocLeft</a></li><li>| <a href="#v:AssocRight">AssocRight</a></li></ul></li><li class="src short"><span class="keyword">data</span> <a href="#t:Operator">Operator</a> s u m a<ul class="subs"><li>= <a href="#v:Infix">Infix</a> (<a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m (a -> a -> a)) <a href="Text-Parsec-Expr.html#t:Assoc">Assoc</a></li><li>| <a href="#v:Prefix">Prefix</a> (<a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m (a -> a))</li><li>| <a href="#v:Postfix">Postfix</a> (<a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m (a -> a))</li></ul></li><li class="src short"><span class="keyword">type</span> <a href="#t:OperatorTable">OperatorTable</a> s u m a = [[<a href="Text-Parsec-Expr.html#t:Operator">Operator</a> s u m a]]</li><li class="src short"><a href="#v:buildExpressionParser">buildExpressionParser</a> :: <a href="Text-Parsec.html#t:Stream">Stream</a> s m t => <a href="Text-Parsec-Expr.html#t:OperatorTable">OperatorTable</a> s u m a -> <a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m a -> <a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Assoc" class="def">Assoc</a> <a href="src/Text-Parsec-Expr.html#Assoc" class="link">Source</a> <a href="#t:Assoc" class="selflink">#</a></p><div class="doc"><p>This data type specifies the associativity of operators: left, right
or none.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:AssocNone" class="def">AssocNone</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a id="v:AssocLeft" class="def">AssocLeft</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a id="v:AssocRight" class="def">AssocRight</a></td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Operator" class="def">Operator</a> s u m a <a href="src/Text-Parsec-Expr.html#Operator" class="link">Source</a> <a href="#t:Operator" class="selflink">#</a></p><div class="doc"><p>This data type specifies operators that work on values of type <code>a</code>.
An operator is either binary infix or unary prefix or postfix. A
binary operator has also an associated associativity.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:Infix" class="def">Infix</a> (<a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m (a -> a -> a)) <a href="Text-Parsec-Expr.html#t:Assoc">Assoc</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a id="v:Prefix" class="def">Prefix</a> (<a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m (a -> a))</td><td class="doc empty"> </td></tr><tr><td class="src"><a id="v:Postfix" class="def">Postfix</a> (<a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m (a -> a))</td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:OperatorTable" class="def">OperatorTable</a> s u m a = [[<a href="Text-Parsec-Expr.html#t:Operator">Operator</a> s u m a]] <a href="src/Text-Parsec-Expr.html#OperatorTable" class="link">Source</a> <a href="#t:OperatorTable" class="selflink">#</a></p><div class="doc"><p>An <code>OperatorTable s u m a</code> is a list of <code>Operator s u m a</code>
lists. The list is ordered in descending
precedence. All operators in one list have the same precedence (but
may have a different associativity).</p></div></div><div class="top"><p class="src"><a id="v:buildExpressionParser" class="def">buildExpressionParser</a> :: <a href="Text-Parsec.html#t:Stream">Stream</a> s m t => <a href="Text-Parsec-Expr.html#t:OperatorTable">OperatorTable</a> s u m a -> <a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m a -> <a href="Text-Parsec.html#t:ParsecT">ParsecT</a> s u m a <a href="src/Text-Parsec-Expr.html#buildExpressionParser" class="link">Source</a> <a href="#v:buildExpressionParser" class="selflink">#</a></p><div class="doc"><p><code>buildExpressionParser table term</code> builds an expression parser for
terms <code>term</code> with operators from <code>table</code>, taking the associativity
and precedence specified in <code>table</code> into account. Prefix and postfix
operators of the same precedence can only occur once (i.e. <code>--2</code> is
not allowed if <code>-</code> is prefix negate). Prefix and postfix operators
of the same precedence associate to the left (i.e. if <code>++</code> is
postfix increment, than <code>-2++</code> equals <code>-1</code>, not <code>-3</code>).</p><p>The <code>buildExpressionParser</code> takes care of all the complexity
involved in building expression parser. Here is an example of an
expression parser that handles prefix signs, postfix increment and
basic arithmetic.</p><pre> expr = buildExpressionParser table term
<?> "expression"
term = parens expr
<|> natural
<?> "simple expression"
table = [ [prefix "-" negate, prefix "+" id ]
, [postfix "++" (+1)]
, [binary "*" (*) AssocLeft, binary "/" (div) AssocLeft ]
, [binary "+" (+) AssocLeft, binary "-" (-) AssocLeft ]
]
binary name fun assoc = Infix (do{ reservedOp name; return fun }) assoc
prefix name fun = Prefix (do{ reservedOp name; return fun })
postfix name fun = Postfix (do{ reservedOp name; return fun })</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|