/usr/share/doc/libghc-attoparsec-doc/html/Data-Attoparsec-ByteString-Char8.html is in libghc-attoparsec-doc 0.10.4.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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | <!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>Data.Attoparsec.ByteString.Char8</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_Data-Attoparsec-ByteString-Char8.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Attoparsec-ByteString-Char8.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">attoparsec-0.10.4.0: Fast combinator parsing for bytestrings and text</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>unknown</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com</td></tr><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Data.Attoparsec.ByteString.Char8</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Character encodings
</a></li><li><a href="#g:2">Parser types
</a></li><li><a href="#g:3">Running parsers
</a><ul><li><a href="#g:4">Result conversion
</a></li></ul></li><li><a href="#g:5">Combinators
</a></li><li><a href="#g:6">Parsing individual characters
</a><ul><li><a href="#g:7">Special character parsers
</a></li><li><a href="#g:8">Fast predicates
</a><ul><li><a href="#g:9">Character classes
</a></li></ul></li></ul></li><li><a href="#g:10">Efficient string handling
</a><ul><li><a href="#g:11">String combinators
</a></li><li><a href="#g:12">Consume all remaining input
</a></li></ul></li><li><a href="#g:13">Text parsing
</a></li><li><a href="#g:14">Numeric parsers
</a></li><li><a href="#g:15">State observation and manipulation functions
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Simple, efficient, character-oriented combinator parsing for
<code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></code> strings, loosely based on the Parsec library.
</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:Parser">Parser</a> = <a href="Data-Attoparsec-Types.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:Result">Result</a> = <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:IResult">IResult</a> t r<ul class="subs"><li>= <a href="#v:Fail">Fail</a> t [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a>] <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> </li><li>| <a href="#v:Partial">Partial</a> (t -> <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r) </li><li>| <a href="#v:Done">Done</a> t r </li></ul></li><li class="src short"><a href="#v:compareResults">compareResults</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> t, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> r) => <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r -> <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:parse">parse</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> a</li><li class="src short"><a href="#v:feed">feed</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r</li><li class="src short"><a href="#v:parseOnly">parseOnly</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> a</li><li class="src short"><a href="#v:parseTest">parseTest</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:parseWith">parseWith</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m => m <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> m (<a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> a)</li><li class="src short"><a href="#v:maybeResult">maybeResult</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> r</li><li class="src short"><a href="#v:eitherResult">eitherResult</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> r</li><li class="src short"><a href="#v:-60--63--62-">(<?>)</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:try">try</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short">module <a href="Data-Attoparsec-Combinator.html">Data.Attoparsec.Combinator</a></li><li class="src short"><a href="#v:char">char</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:char8">char8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a></li><li class="src short"><a href="#v:anyChar">anyChar</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:notChar">notChar</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:peekChar">peekChar</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a>)</li><li class="src short"><a href="#v:satisfy">satisfy</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:digit">digit</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:letter_iso8859_15">letter_iso8859_15</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:letter_ascii">letter_ascii</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:space">space</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:isDigit">isDigit</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isDigit_w8">isDigit_w8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isAlpha_iso8859_15">isAlpha_iso8859_15</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isAlpha_ascii">isAlpha_ascii</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isSpace">isSpace</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isSpace_w8">isSpace_w8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:inClass">inClass</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:notInClass">notInClass</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:string">string</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:stringCI">stringCI</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:skipSpace">skipSpace</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()</li><li class="src short"><a href="#v:skipWhile">skipWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()</li><li class="src short"><a href="#v:take">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:scan">scan</a> :: s -> (s -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> s) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:takeWhile1">takeWhile1</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:takeTill">takeTill</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:.-42--62-">(.*>)</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:-60--42-.">(<*.)</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:takeByteString">takeByteString</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:takeLazyByteString">takeLazyByteString</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:endOfLine">endOfLine</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()</li><li class="src short"><a href="#v:isEndOfLine">isEndOfLine</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isHorizontalSpace">isHorizontalSpace</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:decimal">decimal</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Integral">Integral</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:hexadecimal">hexadecimal</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Integral">Integral</a> a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bits.html#t:Bits">Bits</a> a) => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:signed">signed</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Num">Num</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:double">double</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Number">Number</a> <ul class="subs"><li>= <a href="#v:I">I</a> !<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Integer">Integer</a> </li><li>| <a href="#v:D">D</a> !<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> </li></ul></li><li class="src short"><a href="#v:number">number</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></li><li class="src short"><a href="#v:rational">rational</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Fractional">Fractional</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:endOfInput">endOfInput</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()</li><li class="src short"><a href="#v:atEnd">atEnd</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a></li></ul></div><div id="interface"><h1 id="g:1">Character encodings
</h1><div class="doc"><p>This module is intended for parsing text that is
represented using an 8-bit character set, e.g. ASCII or
ISO-8859-15. It <em>does not</em> make any attempt to deal with character
encodings, multibyte characters, or wide characters. In
particular, all attempts to use characters above code point U+00FF
will give wrong answers.
</p><p>Code points below U+0100 are simply translated to and from their
numeric values, so e.g. the code point U+00A4 becomes the byte
<code>0xA4</code> (which is the Euro symbol in ISO-8859-15, but the generic
currency sign in ISO-8859-1). Haskell <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a></code> values above U+00FF
are truncated, so e.g. U+1D6B7 is truncated to the byte <code>0xB7</code>.
</p></div><h1 id="g:2">Parser types
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Parser" class="def">Parser</a> = <a href="Data-Attoparsec-Types.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Internal.html#Parser" class="link">Source</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Result" class="def">Result</a> = <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Internal.html#Result" class="link">Source</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:IResult" class="def">IResult</a> t r <a href="src/Data-Attoparsec-Internal-Types.html#IResult" class="link">Source</a></p><div class="doc"><p>The result of a parse. This is parameterised over the type <code>t</code>
of string that was processed.
</p><p>This type is an instance of <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a></code>, where <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#v:fmap">fmap</a></code> transforms the
value in a <code><a href="Data-Attoparsec-ByteString-Char8.html#v:Done">Done</a></code> result.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Fail" class="def">Fail</a> t [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a>] <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a></td><td class="doc"><p>The parse failed. The <code>t</code> parameter is the
input that had not yet been consumed when the
failure occurred. The <code>[</code><code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a></code><code>]</code> is a list of
contexts in which the error occurred. The
<code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a></code> is the message describing the error, if
any.
</p></td></tr><tr><td class="src"><a name="v:Partial" class="def">Partial</a> (t -> <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r)</td><td class="doc"><p>Supply this continuation with more input so that
the parser can resume. To indicate that no more
input is available, use an empty string.
</p></td></tr><tr><td class="src"><a name="v:Done" class="def">Done</a> t r</td><td class="doc"><p>The parse succeeded. The <code>t</code> parameter is the
input that had not yet been consumed (if any) when
the parse succeeded.
</p></td></tr></table></div><div class="subs instances"><p id="control.i:IResult" class="caption collapser" onclick="toggleSection('i:IResult')">Instances</p><div id="section.i:IResult" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> (<a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> t, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> r) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> (<a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.1/Control-DeepSeq.html#t:NFData">NFData</a> t, <a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.1/Control-DeepSeq.html#t:NFData">NFData</a> r) => <a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.1/Control-DeepSeq.html#t:NFData">NFData</a> (<a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:compareResults" class="def">compareResults</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> t, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> r) => <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r -> <a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a> t r -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-Internal.html#compareResults" class="link">Source</a></p><div class="doc"><p>Compare two <code><a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a></code> values for equality.
</p><p>If both <code><a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a></code>s are <code><a href="Data-Attoparsec-ByteString-Char8.html#v:Partial">Partial</a></code>, the result will be <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#v:Nothing">Nothing</a></code>, as
they are incomplete and hence their equality cannot be known.
(This is why there is no <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a></code> instance for <code><a href="Data-Attoparsec-ByteString-Char8.html#t:IResult">IResult</a></code>.)
</p></div></div><h1 id="g:3">Running parsers
</h1><div class="top"><p class="src"><a name="v:parse" class="def">parse</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> a<a href="src/Data-Attoparsec-ByteString-Internal.html#parse" class="link">Source</a></p><div class="doc"><p>Run a parser.
</p></div></div><div class="top"><p class="src"><a name="v:feed" class="def">feed</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r<a href="src/Data-Attoparsec-ByteString.html#feed" class="link">Source</a></p><div class="doc"><p>If a parser has returned a <code><a href="Data-Attoparsec-ByteString-Char8.html#v:Partial">Partial</a></code> result, supply it with more
input.
</p></div></div><div class="top"><p class="src"><a name="v:parseOnly" class="def">parseOnly</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> a<a href="src/Data-Attoparsec-ByteString-Internal.html#parseOnly" class="link">Source</a></p><div class="doc"><p>Run a parser that cannot be resupplied via a <code><a href="Data-Attoparsec-ByteString-Char8.html#v:Partial">Partial</a></code> result.
</p></div></div><div class="top"><p class="src"><a name="v:parseTest" class="def">parseTest</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Attoparsec-ByteString.html#parseTest" class="link">Source</a></p><div class="doc"><p>Run a parser and print its result to standard output.
</p></div></div><div class="top"><p class="src"><a name="v:parseWith" class="def">parseWith</a><a href="src/Data-Attoparsec-ByteString.html#parseWith" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m</td><td class="doc empty"> </td></tr><tr><td class="src">=> m <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>An action that will be executed to provide the parser
with more input, if necessary. The action must return an
<code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#v:empty">empty</a></code> string when there is no more input available.
</p></td></tr><tr><td class="src">-> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>Initial input for the parser.
</p></td></tr><tr><td class="src">-> m (<a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> a)</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Run a parser with an initial input string, and a monadic action
that can supply more input if needed.
</p></div></div><h2 id="g:4">Result conversion
</h2><div class="top"><p class="src"><a name="v:maybeResult" class="def">maybeResult</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> r<a href="src/Data-Attoparsec-ByteString.html#maybeResult" class="link">Source</a></p><div class="doc"><p>Convert a <code><a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a></code> value to a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a></code> value. A <code><a href="Data-Attoparsec-ByteString-Char8.html#v:Partial">Partial</a></code> result
is treated as failure.
</p></div></div><div class="top"><p class="src"><a name="v:eitherResult" class="def">eitherResult</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a> r -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> r<a href="src/Data-Attoparsec-ByteString.html#eitherResult" class="link">Source</a></p><div class="doc"><p>Convert a <code><a href="Data-Attoparsec-ByteString-Char8.html#t:Result">Result</a></code> value to an <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a></code> value. A <code><a href="Data-Attoparsec-ByteString-Char8.html#v:Partial">Partial</a></code>
result is treated as failure.
</p></div></div><h1 id="g:5">Combinators
</h1><div class="top"><p class="src"><a name="v:-60--63--62-" class="def">(<?>)</a><a href="src/Data-Attoparsec-ByteString-Internal.html#%3C%3F%3E" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a></td><td class="doc"><p>the name to use if parsing fails
</p></td></tr><tr><td class="src">-> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Name the parser, in case failure occurs.
</p></div></div><div class="top"><p class="src"><a name="v:try" class="def">try</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Internal.html#try" class="link">Source</a></p><div class="doc"><p>Attempt a parse, and if it fails, rewind the input so that no
input appears to have been consumed.
</p><p>This combinator is provided for compatibility with Parsec.
Attoparsec parsers always backtrack on failure.
</p></div></div><div class="top"><p class="src">module <a href="Data-Attoparsec-Combinator.html">Data.Attoparsec.Combinator</a></p></div><h1 id="g:6">Parsing individual characters
</h1><div class="top"><p class="src"><a name="v:char" class="def">char</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#char" class="link">Source</a></p><div class="doc"><p>Match a specific character.
</p></div></div><div class="top"><p class="src"><a name="v:char8" class="def">char8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a><a href="src/Data-Attoparsec-ByteString-Char8.html#char8" class="link">Source</a></p><div class="doc"><p>Match a specific character, but return its <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a></code> value.
</p></div></div><div class="top"><p class="src"><a name="v:anyChar" class="def">anyChar</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#anyChar" class="link">Source</a></p><div class="doc"><p>Match any character.
</p></div></div><div class="top"><p class="src"><a name="v:notChar" class="def">notChar</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#notChar" class="link">Source</a></p><div class="doc"><p>Match any character except the given one.
</p></div></div><div class="top"><p class="src"><a name="v:peekChar" class="def">peekChar</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a>)<a href="src/Data-Attoparsec-ByteString-Char8.html#peekChar" class="link">Source</a></p><div class="doc"><p>Match any character. Returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#v:Nothing">Nothing</a></code> if end of input has been
reached. Does not consume any input.
</p><p><em>Note</em>: Because this parser does not fail, do not use it with
combinators such as <code>many</code>, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
</p></div></div><div class="top"><p class="src"><a name="v:satisfy" class="def">satisfy</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#satisfy" class="link">Source</a></p><div class="doc"><p>The parser <code>satisfy p</code> succeeds for any byte for which the
predicate <code>p</code> returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code>. Returns the byte that is actually
parsed.
</p><pre>digit = satisfy isDigit
where isDigit c = c >= '0' && c <= '9'
</pre></div></div><h2 id="g:7">Special character parsers
</h2><div class="top"><p class="src"><a name="v:digit" class="def">digit</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#digit" class="link">Source</a></p><div class="doc"><p>Parse a single digit.
</p></div></div><div class="top"><p class="src"><a name="v:letter_iso8859_15" class="def">letter_iso8859_15</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#letter_iso8859_15" class="link">Source</a></p><div class="doc"><p>Match a letter, in the ISO-8859-15 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:letter_ascii" class="def">letter_ascii</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#letter_ascii" class="link">Source</a></p><div class="doc"><p>Match a letter, in the ASCII encoding.
</p></div></div><div class="top"><p class="src"><a name="v:space" class="def">space</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a><a href="src/Data-Attoparsec-ByteString-Char8.html#space" class="link">Source</a></p><div class="doc"><p>Parse a space character.
</p><p><em>Note</em>: This parser only gives correct answers for the ASCII
encoding. For instance, it does not recognise U+00A0 (non-breaking
space) as a space character, even though it is a valid ISO-8859-15
byte.
</p></div></div><h2 id="g:8">Fast predicates
</h2><div class="top"><p class="src"><a name="v:isDigit" class="def">isDigit</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isDigit" class="link">Source</a></p><div class="doc"><p>A fast digit predicate.
</p></div></div><div class="top"><p class="src"><a name="v:isDigit_w8" class="def">isDigit_w8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isDigit_w8" class="link">Source</a></p><div class="doc"><p>A fast digit predicate.
</p></div></div><div class="top"><p class="src"><a name="v:isAlpha_iso8859_15" class="def">isAlpha_iso8859_15</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isAlpha_iso8859_15" class="link">Source</a></p><div class="doc"><p>A fast alphabetic predicate for the ISO-8859-15 encoding
</p><p><em>Note</em>: For all character encodings other than ISO-8859-15, and
almost all Unicode code points above U+00A3, this predicate gives
<em>wrong answers</em>.
</p></div></div><div class="top"><p class="src"><a name="v:isAlpha_ascii" class="def">isAlpha_ascii</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isAlpha_ascii" class="link">Source</a></p><div class="doc"><p>A fast alphabetic predicate for the ASCII encoding
</p><p><em>Note</em>: For all character encodings other than ASCII, and
almost all Unicode code points above U+007F, this predicate gives
<em>wrong answers</em>.
</p></div></div><div class="top"><p class="src"><a name="v:isSpace" class="def">isSpace</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isSpace" class="link">Source</a></p><div class="doc"><p>Fast predicate for matching ASCII space characters.
</p><p><em>Note</em>: This predicate only gives correct answers for the ASCII
encoding. For instance, it does not recognise U+00A0 (non-breaking
space) as a space character, even though it is a valid ISO-8859-15
byte. For a Unicode-aware and only slightly slower predicate,
use <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:isSpace">isSpace</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:isSpace_w8" class="def">isSpace_w8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isSpace_w8" class="link">Source</a></p><div class="doc"><p>Fast <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a></code> predicate for matching ASCII space characters.
</p></div></div><h3 id="g:9">Character classes
</h3><div class="top"><p class="src"><a name="v:inClass" class="def">inClass</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#inClass" class="link">Source</a></p><div class="doc"><p>Match any character in a set.
</p><pre>vowel = inClass "aeiou"
</pre><p>Range notation is supported.
</p><pre>halfAlphabet = inClass "a-nA-N"
</pre><p>To add a literal '-' to a set, place it at the beginning or end
of the string.
</p></div></div><div class="top"><p class="src"><a name="v:notInClass" class="def">notInClass</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#notInClass" class="link">Source</a></p><div class="doc"><p>Match any character not in a set.
</p></div></div><h1 id="g:10">Efficient string handling
</h1><div class="top"><p class="src"><a name="v:string" class="def">string</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Internal.html#string" class="link">Source</a></p><div class="doc"><p><code>string s</code> parses a sequence of bytes that identically match
<code>s</code>. Returns the parsed string (i.e. <code>s</code>). This parser consumes no
input if it fails (even if a partial match).
</p><p><em>Note</em>: The behaviour of this parser is different to that of the
similarly-named parser in Parsec, as this one is all-or-nothing.
To illustrate the difference, the following parser will fail under
Parsec given an input of <code>"for"</code>:
</p><pre>string "foo" <|> string "for"
</pre><p>The reason for its failure is that the first branch is a
partial match, and will consume the letters <code>'f'</code> and <code>'o'</code>
before failing. In Attoparsec, the above parser will <em>succeed</em> on
that input, because the failed first branch will consume nothing.
</p></div></div><div class="top"><p class="src"><a name="v:stringCI" class="def">stringCI</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Char8.html#stringCI" class="link">Source</a></p><div class="doc"><p>Satisfy a literal string, ignoring case.
</p></div></div><div class="top"><p class="src"><a name="v:skipSpace" class="def">skipSpace</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()<a href="src/Data-Attoparsec-ByteString-Char8.html#skipSpace" class="link">Source</a></p><div class="doc"><p>Skip over white space.
</p></div></div><div class="top"><p class="src"><a name="v:skipWhile" class="def">skipWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()<a href="src/Data-Attoparsec-ByteString-Char8.html#skipWhile" class="link">Source</a></p><div class="doc"><p>Skip past input for as long as the predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Internal.html#take" class="link">Source</a></p><div class="doc"><p>Consume exactly <code>n</code> bytes of input.
</p></div></div><div class="top"><p class="src"><a name="v:scan" class="def">scan</a> :: s -> (s -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> s) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Char8.html#scan" class="link">Source</a></p><div class="doc"><p>A stateful scanner. The predicate consumes and transforms a
state argument, and each transformed state is passed to successive
invocations of the predicate on each byte of the input until one
returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#v:Nothing">Nothing</a></code> or the input ends.
</p><p>This parser does not fail. It will return an empty string if the
predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#v:Nothing">Nothing</a></code> on the first byte of input.
</p><p><em>Note</em>: Because this parser does not fail, do not use it with
combinators such as <code>many</code>, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
</p></div></div><div class="top"><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Char8.html#takeWhile" class="link">Source</a></p><div class="doc"><p>Consume input as long as the predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code>, and return
the consumed input.
</p><p>This parser does not fail. It will return an empty string if the
predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:False">False</a></code> on the first byte of input.
</p><p><em>Note</em>: Because this parser does not fail, do not use it with
combinators such as <code>many</code>, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
</p></div></div><div class="top"><p class="src"><a name="v:takeWhile1" class="def">takeWhile1</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Char8.html#takeWhile1" class="link">Source</a></p><div class="doc"><p>Consume input as long as the predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code>, and return
the consumed input.
</p><p>This parser requires the predicate to succeed on at least one byte
of input: it will fail if the predicate never returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code> or if
there is no input left.
</p></div></div><div class="top"><p class="src"><a name="v:takeTill" class="def">takeTill</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Char.html#t:Char">Char</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Char8.html#takeTill" class="link">Source</a></p><div class="doc"><p>Consume input as long as the predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:False">False</a></code>
(i.e. until it returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code>), and return the consumed input.
</p><p>This parser does not fail. It will return an empty string if the
predicate returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#v:True">True</a></code> on the first byte of input.
</p><p><em>Note</em>: Because this parser does not fail, do not use it with
combinators such as <code>many</code>, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
</p></div></div><h2 id="g:11">String combinators
</h2><div class="doc"><p>The <code><a href="Data-Attoparsec-ByteString-Char8.html#v:.-42--62-">.*></a></code> and <code><a href="Data-Attoparsec-ByteString-Char8.html#v:-60--42-."><*.</a></code> combinators are intended for use with the
<code>OverloadedStrings</code> language extension. They simplify the common
task of matching a statically known string, then immediately
parsing something else.
</p><p>An example makes this easier to understand:
</p><pre>{-# LANGUAGE OverloadedStrings #-}
shoeSize = "Shoe size: " <code><a href="Data-Attoparsec-ByteString-Char8.html#v:.-42--62-">.*></a></code> <code><a href="Data-Attoparsec-ByteString-Char8.html#v:decimal">decimal</a></code>
</pre><p>If we were to try to use <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#v:-42--62-">*></a></code> above instead, the type checker would
not be able to tell which <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:IsString">IsString</a></code> instance to use for the text
in quotes. We would have to be explicit, using either a type
signature or the <code><a href="Data-Attoparsec-ByteString-Char8.html#v:string">string</a></code> parser.
</p></div><div class="top"><p class="src"><a name="v:.-42--62-" class="def">(.*>)</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Char8.html#.%2A%3E" class="link">Source</a></p><div class="doc"><p>Type-specialized version of <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#v:-42--62-">*></a></code> for <code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:-60--42-." class="def">(<*.)</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Char8.html#%3C%2A." class="link">Source</a></p><div class="doc"><p>Type-specialized version of <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#v:-60--42-"><*</a></code> for <code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></code>.
</p></div></div><h2 id="g:12">Consume all remaining input
</h2><div class="top"><p class="src"><a name="v:takeByteString" class="def">takeByteString</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Internal.html#takeByteString" class="link">Source</a></p><div class="doc"><p>Consume all remaining input and return it as a single string.
</p></div></div><div class="top"><p class="src"><a name="v:takeLazyByteString" class="def">takeLazyByteString</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Data-Attoparsec-ByteString-Internal.html#takeLazyByteString" class="link">Source</a></p><div class="doc"><p>Consume all remaining input and return it as a single string.
</p></div></div><h1 id="g:13">Text parsing
</h1><div class="top"><p class="src"><a name="v:endOfLine" class="def">endOfLine</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()<a href="src/Data-Attoparsec-ByteString-Internal.html#endOfLine" class="link">Source</a></p><div class="doc"><p>Match either a single newline character <code>'\n'</code>, or a carriage
return followed by a newline character <code>"\r\n"</code>.
</p></div></div><div class="top"><p class="src"><a name="v:isEndOfLine" class="def">isEndOfLine</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isEndOfLine" class="link">Source</a></p><div class="doc"><p>A predicate that matches either a carriage return <code>'\r'</code> or
newline <code>'\n'</code> character.
</p></div></div><div class="top"><p class="src"><a name="v:isHorizontalSpace" class="def">isHorizontalSpace</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Char8.html#isHorizontalSpace" class="link">Source</a></p><div class="doc"><p>A predicate that matches either a space <code>' '</code> or horizontal tab
<code>'\t'</code> character.
</p></div></div><h1 id="g:14">Numeric parsers
</h1><div class="top"><p class="src"><a name="v:decimal" class="def">decimal</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Integral">Integral</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Char8.html#decimal" class="link">Source</a></p><div class="doc"><p>Parse and decode an unsigned decimal number.
</p></div></div><div class="top"><p class="src"><a name="v:hexadecimal" class="def">hexadecimal</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Integral">Integral</a> a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bits.html#t:Bits">Bits</a> a) => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Char8.html#hexadecimal" class="link">Source</a></p><div class="doc"><p>Parse and decode an unsigned hexadecimal number. The hex digits
<code>'a'</code> through <code>'f'</code> may be upper or lower case.
</p><p>This parser does not accept a leading <code>"0x"</code> string.
</p></div></div><div class="top"><p class="src"><a name="v:signed" class="def">signed</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Num">Num</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a -> <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Char8.html#signed" class="link">Source</a></p><div class="doc"><p>Parse a number with an optional leading <code>'+'</code> or <code>'-'</code> sign
character.
</p></div></div><div class="top"><p class="src"><a name="v:double" class="def">double</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Data-Attoparsec-ByteString-Char8.html#double" class="link">Source</a></p><div class="doc"><p>Parse a rational number.
</p><p>The syntax accepted by this parser is the same as for <code><a href="Data-Attoparsec-ByteString-Char8.html#v:rational">rational</a></code>.
</p><p><em>Note</em>: This function is almost ten times faster than <code><a href="Data-Attoparsec-ByteString-Char8.html#v:rational">rational</a></code>,
but is slightly less accurate.
</p><p>The <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></code> type supports about 16 decimal places of accuracy.
For 94.2% of numbers, this function and <code><a href="Data-Attoparsec-ByteString-Char8.html#v:rational">rational</a></code> give identical
results, but for the remaining 5.8%, this function loses precision
around the 15th decimal place. For 0.001% of numbers, this
function will lose precision at the 13th or 14th decimal place.
</p><p>This function does not accept string representations of "NaN" or
"Infinity".
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Number" class="def">Number</a> <a href="src/Data-Attoparsec-Number.html#Number" class="link">Source</a></p><div class="doc"><p>A numeric type that can represent integers accurately, and
floating point numbers to the precision of a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></code>.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:I" class="def">I</a> !<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Integer">Integer</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:D" class="def">D</a> !<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:Number" class="caption collapser" onclick="toggleSection('i:Number')">Instances</p><div id="section.i:Number" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Fractional">Fractional</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Num">Num</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Ord.html#t:Ord">Ord</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Real">Real</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:RealFrac">RealFrac</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Show.html#t:Show">Show</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable">Typeable</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.1/Control-DeepSeq.html#t:NFData">NFData</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:number" class="def">number</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="Data-Attoparsec-ByteString-Char8.html#t:Number">Number</a><a href="src/Data-Attoparsec-ByteString-Char8.html#number" class="link">Source</a></p><div class="doc"><p>Parse a number, attempting to preserve both speed and precision.
</p><p>The syntax accepted by this parser is the same as for <code><a href="Data-Attoparsec-ByteString-Char8.html#v:rational">rational</a></code>.
</p><p><em>Note</em>: This function is almost ten times faster than <code><a href="Data-Attoparsec-ByteString-Char8.html#v:rational">rational</a></code>.
On integral inputs, it gives perfectly accurate answers, and on
floating point inputs, it is slightly less accurate than
<code><a href="Data-Attoparsec-ByteString-Char8.html#v:rational">rational</a></code>.
</p><p>This function does not accept string representations of "NaN" or
"Infinity".
</p></div></div><div class="top"><p class="src"><a name="v:rational" class="def">rational</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Fractional">Fractional</a> a => <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> a<a href="src/Data-Attoparsec-ByteString-Char8.html#rational" class="link">Source</a></p><div class="doc"><p>Parse a rational number.
</p><p>This parser accepts an optional leading sign character, followed by
at least one decimal digit. The syntax similar to that accepted by
the <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Read.html#v:read">read</a></code> function, with the exception that a trailing <code>'.'</code> or
<code>'e'</code> <em>not</em> followed by a number is not consumed.
</p><p>Examples with behaviour identical to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Read.html#v:read">read</a></code>, if you feed an empty
continuation to the first result:
</p><pre>rational "3" == Done 3.0 ""
rational "3.1" == Done 3.1 ""
rational "3e4" == Done 30000.0 ""
rational "3.1e4" == Done 31000.0, ""
</pre><p>Examples with behaviour identical to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Read.html#v:read">read</a></code>:
</p><pre>rational ".3" == Fail "input does not start with a digit"
rational "e3" == Fail "input does not start with a digit"
</pre><p>Examples of differences from <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Text-Read.html#v:read">read</a></code>:
</p><pre>rational "3.foo" == Done 3.0 ".foo"
rational "3e" == Done 3.0 "e"
</pre><p>This function does not accept string representations of "NaN" or
"Infinity".
</p></div></div><h1 id="g:15">State observation and manipulation functions
</h1><div class="top"><p class="src"><a name="v:endOfInput" class="def">endOfInput</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> ()<a href="src/Data-Attoparsec-ByteString-Internal.html#endOfInput" class="link">Source</a></p><div class="doc"><p>Match only if all input has been consumed.
</p></div></div><div class="top"><p class="src"><a name="v:atEnd" class="def">atEnd</a> :: <a href="Data-Attoparsec-ByteString-Char8.html#t:Parser">Parser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Attoparsec-ByteString-Internal.html#atEnd" class="link">Source</a></p><div class="doc"><p>Return an indication of whether the end of input has been
reached.
</p></div></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>
|