/usr/share/doc/libghc-text-doc/html/Data-Text-Encoding-Error.html is in libghc-text-doc 0.11.1.13-1build1.
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 | <!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.Text.Encoding.Error</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-Text-Encoding-Error.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text-Encoding-Error.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">text-0.11.1.13: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>GHC</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com, rtomharper@googlemail.com,
duncan@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Data.Text.Encoding.Error</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Error handling types
</a></li><li><a href="#g:2">Useful error handling functions
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Types and functions for dealing with encoding and decoding errors
in Unicode text.
</p><p>The standard functions for encoding and decoding text are strict,
which is to say that they throw exceptions on invalid input. This
is often unhelpful on real world input, so alternative functions
exist that accept custom handlers for dealing with invalid inputs.
These <code><a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a></code> handlers are normal Haskell functions. You can use
one of the presupplied functions in this module, or you can write a
custom handler of your own.
</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:UnicodeException">UnicodeException</a> <ul class="subs"><li>= <a href="#v:DecodeError">DecodeError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a>) </li><li>| <a href="#v:EncodeError">EncodeError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) </li></ul></li><li class="src short"><span class="keyword">type</span> <a href="#t:OnError">OnError</a> a b = <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> b</li><li class="src short"><span class="keyword">type</span> <a href="#t:OnDecodeError">OnDecodeError</a> = <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:OnEncodeError">OnEncodeError</a> = <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a></li><li class="src short"><a href="#v:lenientDecode">lenientDecode</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a></li><li class="src short"><a href="#v:strictDecode">strictDecode</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a></li><li class="src short"><a href="#v:strictEncode">strictEncode</a> :: <a href="Data-Text-Encoding-Error.html#t:OnEncodeError">OnEncodeError</a></li><li class="src short"><a href="#v:ignore">ignore</a> :: <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> a b</li><li class="src short"><a href="#v:replace">replace</a> :: b -> <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> a b</li></ul></div><div id="interface"><h1 id="g:1">Error handling types
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:UnicodeException" class="def">UnicodeException</a> <a href="src/Data-Text-Encoding-Error.html#UnicodeException" class="link">Source</a></p><div class="doc"><p>An exception type for representing Unicode encoding errors.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:DecodeError" class="def">DecodeError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a>)</td><td class="doc"><p>Could not decode a byte sequence because it was invalid under
the given encoding, or ran out of input in mid-decode.
</p></td></tr><tr><td class="src"><a name="v:EncodeError" class="def">EncodeError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)</td><td class="doc"><p>Tried to encode a character that could not be represented
under the given encoding, or ran out of input in mid-encode.
</p></td></tr></table></div><div class="subs instances"><p id="control.i:UnicodeException" class="caption collapser" onclick="toggleSection('i:UnicodeException')">Instances</p><div id="section.i:UnicodeException" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></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/Text-Show.html#t:Show">Show</a> <a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></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/Data-Typeable-Internal.html#t:Typeable">Typeable</a> <a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></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-Exception-Base.html#t:Exception">Exception</a> <a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:OnError" class="def">OnError</a> a b = <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> b<a href="src/Data-Text-Encoding-Error.html#OnError" class="link">Source</a></p><div class="doc"><p>Function type for handling a coding error. It is supplied with
two inputs:
</p><ul><li> A <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> that describes the error.
</li><li> The input value that caused the error. If the error arose
because the end of input was reached or could not be identified
precisely, this value will be <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code>.
</li></ul><p>If the handler returns a value wrapped with <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Just">Just</a></code>, that value will
be used in the output as the replacement for the invalid input. If
it returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code>, no value will be used in the output.
</p><p>Should the handler need to abort processing, it should use <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Prelude.html#v:error">error</a></code>
or <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Exception-Base.html#v:throw">throw</a></code> an exception (preferably a <code><a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></code>). It may
use the description provided to construct a more helpful error
report.
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:OnDecodeError" class="def">OnDecodeError</a> = <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text-Encoding-Error.html#OnDecodeError" class="link">Source</a></p><div class="doc"><p>A handler for a decoding error.
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:OnEncodeError" class="def">OnEncodeError</a> = <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a><a href="src/Data-Text-Encoding-Error.html#OnEncodeError" class="link">Source</a></p><div class="doc"><p>A handler for an encoding error.
</p></div></div><h1 id="g:2">Useful error handling functions
</h1><div class="top"><p class="src"><a name="v:lenientDecode" class="def">lenientDecode</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a><a href="src/Data-Text-Encoding-Error.html#lenientDecode" class="link">Source</a></p><div class="doc"><p>Replace an invalid input byte with the Unicode replacement
character U+FFFD.
</p></div></div><div class="top"><p class="src"><a name="v:strictDecode" class="def">strictDecode</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a><a href="src/Data-Text-Encoding-Error.html#strictDecode" class="link">Source</a></p><div class="doc"><p>Throw a <code><a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></code> if decoding fails.
</p></div></div><div class="top"><p class="src"><a name="v:strictEncode" class="def">strictEncode</a> :: <a href="Data-Text-Encoding-Error.html#t:OnEncodeError">OnEncodeError</a><a href="src/Data-Text-Encoding-Error.html#strictEncode" class="link">Source</a></p><div class="doc"><p>Throw a <code><a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a></code> if encoding fails.
</p></div></div><div class="top"><p class="src"><a name="v:ignore" class="def">ignore</a> :: <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> a b<a href="src/Data-Text-Encoding-Error.html#ignore" class="link">Source</a></p><div class="doc"><p>Ignore an invalid input, substituting nothing in the output.
</p></div></div><div class="top"><p class="src"><a name="v:replace" class="def">replace</a> :: b -> <a href="Data-Text-Encoding-Error.html#t:OnError">OnError</a> a b<a href="src/Data-Text-Encoding-Error.html#replace" class="link">Source</a></p><div class="doc"><p>Replace an invalid input with a valid output.
</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>
|