/usr/share/doc/libghc-polyparse-doc/html/Text-ParserCombinators-Poly-Parser.html is in libghc-polyparse-doc 1.7-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 25 26 27 28 29 30 31 32 33 34 35 36 37 | <!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.ParserCombinators.Poly.Parser</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-ParserCombinators-Poly-Parser.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-ParserCombinators-Poly-Parser.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">polyparse-1.7: A variety of alternative parser combinator libraries.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Text.ParserCombinators.Poly.Parser</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The Parser datatype
</a><ul><li><a href="#g:2">Basic parsers
</a></li><li><a href="#g:3">Re-parsing
</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module contains the definitions for a generic parser, without
running state. These are the parts that are shared between the Plain
and Lazy variations. Do not import this module directly, but only
via T.P.Poly.Plain or T.P.Poly.Lazy.
</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">newtype</span> <a href="#t:Parser">Parser</a> t a = <a href="#v:P">P</a> ([t] -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Result">Result</a> [t] a)</li><li class="src short"><span class="keyword">data</span> <a href="#t:Result">Result</a> z a<ul class="subs"><li>= <a href="#v:Success">Success</a> z a </li><li>| <a href="#v:Failure">Failure</a> z <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> </li><li>| <a href="#v:Committed">Committed</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Result">Result</a> z a) </li></ul></li><li class="src short"><a href="#v:next">next</a> :: <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t t</li><li class="src short"><a href="#v:eof">eof</a> :: <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:satisfy">satisfy</a> :: (t -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t t</li><li class="src short"><a href="#v:onFail">onFail</a> :: <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t a -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t a -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t a</li><li class="src short"><a href="#v:reparse">reparse</a> :: [t] -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li></ul></div><div id="interface"><h1 id="g:1">The Parser datatype
</h1><div class="top"><p class="src"><span class="keyword">newtype</span> <a name="t:Parser" class="def">Parser</a> t a <a href="src/Text-ParserCombinators-Poly-Parser.html#Parser" class="link">Source</a></p><div class="doc"><p>This <code>Parser</code> datatype is a fairly generic parsing monad with error
reporting. It can be used for arbitrary token types, not just
String input. (If you require a running state, use module Poly.State
instead)
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:P" class="def">P</a> ([t] -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Result">Result</a> [t] a)</td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:Parser" class="caption collapser" onclick="toggleSection('i:Parser')">Instances</p><div id="section.i:Parser" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Alternative">Alternative</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-ParserCombinators-Poly-Base.html#t:PolyParse">PolyParse</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-ParserCombinators-Poly-Base.html#t:Commitment">Commitment</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Result" class="def">Result</a> z a <a href="src/Text-ParserCombinators-Poly-Result.html#Result" class="link">Source</a></p><div class="doc"><p>A return type like Either, that distinguishes not only between
right and wrong answers, but also has commitment, so that a failure
cannot be undone. This should only be used for writing very primitive
parsers - really it is an internal detail of the library.
The z type is the remaining unconsumed input.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Success" class="def">Success</a> z a</td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:Failure" class="def">Failure</a> z <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:Committed" class="def">Committed</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Result">Result</a> z a)</td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:Result" class="caption collapser" onclick="toggleSection('i:Result')">Instances</p><div id="section.i:Result" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> (<a href="Text-ParserCombinators-Poly-Parser.html#t:Result">Result</a> z)</td><td class="doc empty"> </td></tr></table></div></div></div><h2 id="g:2">Basic parsers
</h2><div class="top"><p class="src"><a name="v:next" class="def">next</a> :: <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t t<a href="src/Text-ParserCombinators-Poly-Parser.html#next" class="link">Source</a></p><div class="doc"><p>Simply return the next token in the input tokenstream.
</p></div></div><div class="top"><p class="src"><a name="v:eof" class="def">eof</a> :: <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Text-ParserCombinators-Poly-Parser.html#eof" class="link">Source</a></p><div class="doc"><p>Succeed if the end of file/input has been reached, fail otherwise.
</p></div></div><div class="top"><p class="src"><a name="v:satisfy" class="def">satisfy</a> :: (t -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t t<a href="src/Text-ParserCombinators-Poly-Parser.html#satisfy" class="link">Source</a></p><div class="doc"><p>Return the next token if it satisfies the given predicate.
</p></div></div><div class="top"><p class="src"><a name="v:onFail" class="def">onFail</a> :: <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t a -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t a -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t a<a href="src/Text-ParserCombinators-Poly-Parser.html#onFail" class="link">Source</a></p><div class="doc"><p><code>p <code><a href="Text-ParserCombinators-Poly-Parser.html#v:onFail">onFail</a></code> q</code> means parse p, unless p fails, in which case
parse q instead.
Can be chained together to give multiple attempts to parse something.
(Note that q could itself be a failing parser, e.g. to change the error
message from that defined in p to something different.)
However, a severe failure in p cannot be ignored.
</p></div></div><h2 id="g:3">Re-parsing
</h2><div class="top"><p class="src"><a name="v:reparse" class="def">reparse</a> :: [t] -> <a href="Text-ParserCombinators-Poly-Parser.html#t:Parser">Parser</a> t <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Text-ParserCombinators-Poly-Parser.html#reparse" class="link">Source</a></p><div class="doc"><p>Push some tokens back onto the front of the input stream and reparse.
This is useful e.g. for recursively expanding macros. When the
user-parser recognises a macro use, it can lookup the macro
expansion from the parse state, lex it, and then stuff the
lexed expansion back down into the parser.
</p></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>
|