blob: 4ad1c27e97b17241c5b2016b4771a8182120eea5 (
plain) (
tree)
|
|
<html xmlns="http://www.w3.org/1999/xhtml"
><head
><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/><title
>Hash</title
><link href="#" rel="stylesheet" type="text/css" title="Ocean"
/><script src="haddock-util.js" type="text/javascript"
></script
><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"
></script
><script type="text/javascript"
>//
window.onload = function () {pageLoad();};
//
</script
></head
><body
><div id="package-header"
><ul class="links" id="page-menu"
><li
><a href="#"
>Contents</a
></li
><li
><a href="#"
>Index</a
></li
></ul
><p class="caption empty"
></p
></div
><div id="content"
><div id="module-header"
><table class="info"
><tr
><th
>Safe Haskell</th
><td
>Safe</td
></tr
></table
><p class="caption"
>Hash</p
></div
><div id="table-of-contents"
><p class="caption"
>Contents</p
><ul
><li
><a href="#"
>The <code
>HashTable</code
> type</a
><ul
><li
><a href="#"
>Operations on <code
>HashTable</code
>s</a
></li
></ul
></li
><li
><a href="#"
>The <code
>Hash</code
> class</a
></li
></ul
></div
><div id="description"
><p class="caption"
>Description</p
><div class="doc"
><p
>Implementation of fixed-size hash tables, with a type
class for constructing hash values for structured types.</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="#"
>HashTable</a
> key val</li
><li class="src short"
><a href="#"
>new</a
> :: (<a href="#"
>Eq</a
> key, <a href="#"
>Hash</a
> key) => <a href="#"
>Int</a
> -> <a href="#"
>IO</a
> (<a href="#"
>HashTable</a
> key val)</li
><li class="src short"
><a href="#"
>insert</a
> :: (<a href="#"
>Eq</a
> key, <a href="#"
>Hash</a
> key) => key -> val -> <a href="#"
>IO</a
> ()</li
><li class="src short"
><a href="#"
>lookup</a
> :: <a href="#"
>Hash</a
> key => key -> <a href="#"
>IO</a
> (<a href="#"
>Maybe</a
> val)</li
><li class="src short"
><span class="keyword"
>class</span
> <a href="#"
>Hash</a
> a <span class="keyword"
>where</span
><ul class="subs"
></ul
></li
></ul
></div
><div id="interface"
><h1 id="g:1"
>The <code
>HashTable</code
> type</h1
><div class="top"
><p class="src"
><span class="keyword"
>data</span
> <a id="t:HashTable" class="def"
>HashTable</a
> key val <a href="#" class="selflink"
>#</a
></p
><div class="doc"
><p
>A hash table with keys of type <code
>key</code
> and values of type <code
>val</code
>.
The type <code
>key</code
> should be an instance of <code
><a href="#"
>Eq</a
></code
>.</p
></div
></div
><h2 id="g:2"
>Operations on <code
>HashTable</code
>s</h2
><div class="top"
><p class="src"
><a id="v:new" class="def"
>new</a
> :: (<a href="#"
>Eq</a
> key, <a href="#"
>Hash</a
> key) => <a href="#"
>Int</a
> -> <a href="#"
>IO</a
> (<a href="#"
>HashTable</a
> key val) <a href="#" class="selflink"
>#</a
></p
><div class="doc"
><p
>Builds a new hash table with a given size</p
></div
></div
><div class="top"
><p class="src"
><a id="v:insert" class="def"
>insert</a
> :: (<a href="#"
>Eq</a
> key, <a href="#"
>Hash</a
> key) => key -> val -> <a href="#"
>IO</a
> () <a href="#" class="selflink"
>#</a
></p
><div class="doc"
><p
>Inserts a new element into the hash table</p
></div
></div
><div class="top"
><p class="src"
><a id="v:lookup" class="def"
>lookup</a
> :: <a href="#"
>Hash</a
> key => key -> <a href="#"
>IO</a
> (<a href="#"
>Maybe</a
> val) <a href="#" class="selflink"
>#</a
></p
><div class="doc"
><p
>Looks up a key in the hash table, returns <code
><code
><a href="#"
>Just</a
></code
> val</code
> if the key
was found, or <code
><a href="#"
>Nothing</a
></code
> otherwise.</p
></div
></div
><h1 id="g:3"
>The <code
>Hash</code
> class</h1
><div class="top"
><p class="src"
><span class="keyword"
>class</span
> <a id="t:Hash" class="def"
>Hash</a
> a <span class="keyword"
>where</span
> <a href="#" class="selflink"
>#</a
></p
><div class="doc"
><p
>A class of types which can be hashed.</p
></div
><div class="subs minimal"
><p class="caption"
>Minimal complete definition</p
><p class="src"
><a href="#"
>hash</a
></p
></div
><div class="subs methods"
><p class="caption"
>Methods</p
><p class="src"
><a id="v:hash" class="def"
>hash</a
> :: a -> <a href="#"
>Int</a
> <a href="#" class="selflink"
>#</a
></p
><div class="doc"
><p
>hashes the value of type <code
>a</code
> into an <code
><a href="#"
>Int</a
></code
></p
></div
></div
><div class="subs instances"
><p id="control.i:Hash" class="caption collapser" onclick="toggleSection('i:Hash')"
>Instances</p
><div id="section.i:Hash" class="show"
><table
><tr
><td class="src clearfix"
><span class="inst-left"
><span id="control.i:ic:Hash:Hash:1" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:1')"
></span
> <a href="#"
>Hash</a
> <a href="#"
>Float</a
></span
> <a href="#" class="selflink"
>#</a
></td
><td class="doc empty"
></td
></tr
><tr
><td colspan="2"
><div id="section.i:ic:Hash:Hash:1" class="inst-details hide"
><div class="subs methods"
><p class="caption"
>Methods</p
><p class="src"
><a href="#"
>hash</a
> :: <a href="#"
>Float</a
> -> <a href="#"
>Int</a
> <a href="#" class="selflink"
>#</a
></p
></div
></div
></td
></tr
><tr
><td class="src clearfix"
><span class="inst-left"
><span id="control.i:ic:Hash:Hash:2" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:2')"
></span
> <a href="#"
>Hash</a
> <a href="#"
>Int</a
></span
> <a href="#" class="selflink"
>#</a
></td
><td class="doc empty"
></td
></tr
><tr
><td colspan="2"
><div id="section.i:ic:Hash:Hash:2" class="inst-details hide"
><div class="subs methods"
><p class="caption"
>Methods</p
><p class="src"
><a href="#"
>hash</a
> :: <a href="#"
>Int</a
> -> <a href="#"
>Int</a
> <a href="#" class="selflink"
>#</a
></p
></div
></div
></td
></tr
><tr
><td class="src clearfix"
><span class="inst-left"
><span id="control.i:ic:Hash:Hash:3" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:3')"
></span
> (<a href="#"
>Hash</a
> a, <a href="#"
>Hash</a
> b) => <a href="#"
>Hash</a
> (a, b)</span
> <a href="#" class="selflink"
>#</a
></td
><td class="doc empty"
></td
></tr
><tr
><td colspan="2"
><div id="section.i:ic:Hash:Hash:3" class="inst-details hide"
><div class="subs methods"
><p class="caption"
>Methods</p
><p class="src"
><a href="#"
>hash</a
> :: (a, b) -> <a href="#"
>Int</a
> <a href="#" class="selflink"
>#</a
></p
></div
></div
></td
></tr
></table
></div
></div
></div
></div
></div
><div id="footer"
></div
></body
></html
>
|