<!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 >Hash</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_Hash.html");}; //]]> </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 >None</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" ><li ><a href="" >hash</a > :: a -> <a href="" >Int</a ></li ></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 name="t:HashTable" class="def" >HashTable</a > key val </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 name="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)</p ><div class="doc" ><p >Builds a new hash table with a given size </p ></div ></div ><div class="top" ><p class="src" ><a name="v:insert" class="def" >insert</a > :: (<a href="" >Eq</a > key, <a href="" >Hash</a > key) => key -> val -> <a href="" >IO</a > ()</p ><div class="doc" ><p >Inserts a new element into the hash table </p ></div ></div ><div class="top" ><p class="src" ><a name="v:lookup" class="def" >lookup</a > :: <a href="" >Hash</a > key => key -> <a href="" >IO</a > (<a href="" >Maybe</a > val)</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 name="t:Hash" class="def" >Hash</a > a <span class="keyword" >where</span ></p ><div class="doc" ><p >A class of types which can be hashed. </p ></div ><div class="subs methods" ><p class="caption" >Methods</p ><p class="src" ><a name="v:hash" class="def" >hash</a > :: a -> <a href="" >Int</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" ><a href="" >Hash</a > <a href="" >Float</a ></td ><td class="doc empty" > </td ></tr ><tr ><td class="src" ><a href="" >Hash</a > <a href="" >Int</a ></td ><td class="doc empty" > </td ></tr ><tr ><td class="src" >(<a href="" >Hash</a > a, <a href="" >Hash</a > b) => <a href="" >Hash</a > (a, b)</td ><td class="doc empty" > </td ></tr ></table ></div ></div ></div ></div ></div ><div id="footer" ><p >Produced by <a href="" >Haddock</a > version 2.13.2</p ></div ></body ></html >